summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-10 15:52:27 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-10 15:52:27 +0000
commit43211582b1fa8c69136385250e7b0446cf364b5c (patch)
tree655ab01543012b6fd5699dee8fab92876959b7d9 /chrome/browser/instant
parentd43970a7ceee5fc5433787b0f28b64234a4039f2 (diff)
downloadchromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.zip
chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.tar.gz
chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.tar.bz2
Moving notification types which are chrome specific to a new header file chrome_notification_types.h.
This file lives in chrome\common. The chrome specific notifications start from NOTIFICATION_CONTENT_END which defines the end of the enum used by content to define notification types. The notificaton_type.h file in content\common has been renamed to content_notification_types.h BUG=76698 Review URL: http://codereview.chromium.org/7327007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r--chrome/browser/instant/instant_browsertest.cc17
-rw-r--r--chrome/browser/instant/instant_controller.cc5
-rw-r--r--chrome/browser/instant/instant_loader.cc57
-rw-r--r--chrome/browser/instant/instant_loader.h2
4 files changed, 42 insertions, 39 deletions
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index b2e64cb..a42698d 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
@@ -51,7 +52,7 @@ class InstantTest : public InProcessBrowserTest {
if (!model->loaded()) {
model->Load();
ui_test_utils::WaitForNotification(
- NotificationType::TEMPLATE_URL_SERVICE_LOADED);
+ chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED);
}
ASSERT_TRUE(model->loaded());
@@ -123,7 +124,7 @@ class InstantTest : public InProcessBrowserTest {
ASSERT_NO_FATAL_FAILURE(FindLocationBar());
location_bar_->location_entry()->SetUserText(UTF8ToUTF16(text));
ui_test_utils::WaitForNotification(
- NotificationType::INSTANT_CONTROLLER_SHOWN);
+ chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN);
}
const string16& GetSuggestion() const {
@@ -599,7 +600,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_SearchServerDoesntSupportInstant) {
// When the response comes back that the page doesn't support instant the tab
// should be closed.
- ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED);
+ ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_CLOSED);
EXPECT_FALSE(browser()->instant()->IsShowingInstant());
EXPECT_FALSE(browser()->instant()->is_displayable());
EXPECT_TRUE(browser()->instant()->is_active());
@@ -649,7 +650,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest,
// When the response comes back that the page doesn't support instant the tab
// should be closed.
- ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED);
+ ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_CLOSED);
EXPECT_FALSE(browser()->instant()->IsShowingInstant());
EXPECT_FALSE(browser()->instant()->is_displayable());
// But because the omnibox is still open, instant should be active.
@@ -705,7 +706,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) {
ASSERT_FALSE(browser()->instant()->is_displayable());
// When instant sees the 403, it should close the tab.
- ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED);
+ ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_CLOSED);
ASSERT_FALSE(browser()->instant()->GetPreviewContents());
ASSERT_TRUE(browser()->instant()->is_active());
ASSERT_FALSE(browser()->instant()->is_displayable());
@@ -869,7 +870,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, DontCrashOnBlockedJS) {
ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
// Wait for notification that the instant API has been determined.
ui_test_utils::WaitForNotification(
- NotificationType::INSTANT_SUPPORT_DETERMINED);
+ chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED);
// As long as we get the notification we're good (the renderer didn't crash).
}
@@ -894,11 +895,11 @@ IN_PROC_BROWSER_TEST_F(InstantTest, DownloadOnEnter) {
// Wait for the load to fail (because instant disables downloads).
printf("1\n");
ui_test_utils::WaitForNotification(
- NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR);
+ content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR);
printf("2\n");
ui_test_utils::WindowedNotificationObserver download_observer(
- NotificationType::DOWNLOAD_INITIATED,
+ chrome::NOTIFICATION_DOWNLOAD_INITIATED,
NotificationService::AllSources());
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN));
printf("3\n");
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index c7a6653..c25f62c 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -207,7 +208,7 @@ void InstantController::Update(TabContentsWrapper* tab_contents,
}
NotificationService::current()->Notify(
- NotificationType::INSTANT_CONTROLLER_UPDATED,
+ chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED,
Source<InstantController>(this),
NotificationService::NoDetails());
}
@@ -569,7 +570,7 @@ void InstantController::UpdateDisplayableLoader() {
} else {
delegate_->ShowInstant(displayable_loader_->preview_contents());
NotificationService::current()->Notify(
- NotificationType::INSTANT_CONTROLLER_SHOWN,
+ chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN,
Source<InstantController>(this),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 0e7fc35..d7f47d1 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/ui/download/download_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -37,12 +38,12 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "content/browser/tab_contents/tab_contents_view.h"
+#include "content/common/content_notification_types.h"
#include "content/common/notification_details.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "content/common/notification_service.h"
#include "content/common/notification_source.h"
-#include "content/common/notification_type.h"
#include "content/common/page_transition_types.h"
#include "content/common/renderer_preferences.h"
#include "net/http/http_util.h"
@@ -78,7 +79,7 @@ class InstantLoader::FrameLoadObserver : public NotificationObserver {
text_(text),
verbatim_(verbatim),
unique_id_(tab_contents_->controller().pending_entry()->unique_id()) {
- registrar_.Add(this, NotificationType::LOAD_COMPLETED_MAIN_FRAME,
+ registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
Source<TabContents>(tab_contents_));
}
@@ -89,7 +90,7 @@ class InstantLoader::FrameLoadObserver : public NotificationObserver {
void set_verbatim(bool verbatim) { verbatim_ = verbatim; }
// NotificationObserver:
- virtual void Observe(NotificationType type,
+ virtual void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) OVERRIDE;
@@ -115,11 +116,11 @@ class InstantLoader::FrameLoadObserver : public NotificationObserver {
};
void InstantLoader::FrameLoadObserver::Observe(
- NotificationType type,
+ int type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type.value) {
- case NotificationType::LOAD_COMPLETED_MAIN_FRAME: {
+ switch (type) {
+ case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
int page_id = *(Details<int>(details).ptr());
NavigationEntry* active_entry =
tab_contents_->controller().GetActiveEntry();
@@ -176,7 +177,7 @@ class InstantLoader::TabContentsDelegateImpl
void UnregisterForPaintNotifications();
// NotificationObserver:
- virtual void Observe(NotificationType type,
+ virtual void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) OVERRIDE;
@@ -268,9 +269,9 @@ InstantLoader::TabContentsDelegateImpl::TabContentsDelegateImpl(
is_mouse_down_from_activate_(false),
user_typed_before_load_(false) {
DCHECK(loader->preview_contents());
- registrar_.Add(this, NotificationType::INTERSTITIAL_ATTACHED,
+ registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED,
Source<TabContents>(loader->preview_contents()->tab_contents()));
- registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
+ registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
Source<NavigationController>(&loader->preview_contents()->controller()));
}
@@ -354,9 +355,9 @@ void InstantLoader::TabContentsDelegateImpl::RegisterForPaintNotifications(
registered_render_widget_host_ = render_widget_host;
Source<RenderWidgetHost> source =
Source<RenderWidgetHost>(registered_render_widget_host_);
- registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT,
+ registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT,
source);
- registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
+ registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
source);
}
@@ -364,20 +365,20 @@ void InstantLoader::TabContentsDelegateImpl::UnregisterForPaintNotifications() {
if (registered_render_widget_host_) {
Source<RenderWidgetHost> source =
Source<RenderWidgetHost>(registered_render_widget_host_);
- registrar_.Remove(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT,
+ registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT,
source);
- registrar_.Remove(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
+ registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
source);
registered_render_widget_host_ = NULL;
}
}
void InstantLoader::TabContentsDelegateImpl::Observe(
- NotificationType type,
+ int type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type.value) {
- case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR:
+ switch (type) {
+ case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR:
if (Details<ProvisionalLoadDetails>(details)->url() == loader_->url_) {
// This typically happens with downloads (which are disabled with
// instant active). To ensure the download happens when the user presses
@@ -385,14 +386,14 @@ void InstantLoader::TabContentsDelegateImpl::Observe(
loader_->needs_reload_ = true;
}
break;
- case NotificationType::RENDER_WIDGET_HOST_DID_PAINT:
+ case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT:
UnregisterForPaintNotifications();
PreviewPainted();
break;
- case NotificationType::RENDER_WIDGET_HOST_DESTROYED:
+ case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED:
UnregisterForPaintNotifications();
break;
- case NotificationType::INTERSTITIAL_ATTACHED:
+ case content::NOTIFICATION_INTERSTITIAL_ATTACHED:
PreviewPainted();
break;
default:
@@ -551,7 +552,7 @@ void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined(
Details<const bool> details(&result);
NotificationService::current()->Notify(
- NotificationType::INSTANT_SUPPORT_DETERMINED,
+ chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED,
NotificationService::AllSources(),
details);
@@ -747,7 +748,7 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents(
SetTakesFocusOnlyOnMouseDown(false);
registrar_.Remove(
this,
- NotificationType::RENDER_VIEW_HOST_CHANGED,
+ chrome::RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(&preview_contents_->controller()));
#endif
}
@@ -853,11 +854,11 @@ void InstantLoader::ShowPreview() {
}
}
-void InstantLoader::Observe(NotificationType type,
+void InstantLoader::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
#if defined(OS_MACOSX)
- if (type.value == NotificationType::RENDER_VIEW_HOST_CHANGED) {
+ if (type == chrome::RENDER_VIEW_HOST_CHANGED) {
if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) {
preview_contents_->tab_contents()->GetRenderWidgetHostView()->
SetTakesFocusOnlyOnMouseDown(true);
@@ -865,7 +866,7 @@ void InstantLoader::Observe(NotificationType type,
return;
}
#endif
- if (type.value == NotificationType::NAV_ENTRY_COMMITTED) {
+ if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
content::LoadCommittedDetails* load_details =
Details<content::LoadCommittedDetails>(details).ptr();
if (load_details->is_main_frame) {
@@ -954,11 +955,11 @@ void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc,
#if defined(OS_MACOSX)
registrar_.Remove(this,
- NotificationType::RENDER_VIEW_HOST_CHANGED,
+ content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(&old_tc->controller()));
#endif
registrar_.Remove(this,
- NotificationType::NAV_ENTRY_COMMITTED,
+ content::NOTIFICATION_NAV_ENTRY_COMMITTED,
Source<NavigationController>(&old_tc->controller()));
// We prerendered so we should be ready to show. If we're ready, swap in
@@ -995,13 +996,13 @@ void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) {
}
registrar_.Add(
this,
- NotificationType::RENDER_VIEW_HOST_CHANGED,
+ content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(&preview_contents_->controller()));
#endif
registrar_.Add(
this,
- NotificationType::NAV_ENTRY_COMMITTED,
+ content::NOTIFICATION_NAV_ENTRY_COMMITTED,
Source<NavigationController>(&preview_contents_->controller()));
gfx::Rect tab_bounds;
diff --git a/chrome/browser/instant/instant_loader.h b/chrome/browser/instant/instant_loader.h
index d28a6d6..daa6631 100644
--- a/chrome/browser/instant/instant_loader.h
+++ b/chrome/browser/instant/instant_loader.h
@@ -75,7 +75,7 @@ class InstantLoader : public NotificationObserver {
const TemplateURL* template_url);
// NotificationObserver:
- virtual void Observe(NotificationType type,
+ virtual void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) OVERRIDE;