diff options
Diffstat (limited to 'chrome/browser/automation')
11 files changed, 365 insertions, 342 deletions
diff --git a/chrome/browser/automation/automation_extension_tracker.cc b/chrome/browser/automation/automation_extension_tracker.cc index 6ba03ab..93e24c5 100644 --- a/chrome/browser/automation/automation_extension_tracker.cc +++ b/chrome/browser/automation/automation_extension_tracker.cc @@ -24,16 +24,18 @@ void AutomationExtensionTracker::AddObserver(const Extension* resource) {} void AutomationExtensionTracker::RemoveObserver(const Extension* resource) {} -void AutomationExtensionTracker::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void AutomationExtensionTracker::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type != chrome::NOTIFICATION_EXTENSION_UNLOADED) { NOTREACHED(); return; } - UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); + UnloadedExtensionInfo* info = + content::Details<UnloadedExtensionInfo>(details).ptr(); const Extension* extension = info->extension; - Profile* profile = Source<Profile>(source).ptr(); + Profile* profile = content::Source<Profile>(source).ptr(); if (profile) { ExtensionService* service = profile->GetExtensionService(); if (service && info->reason == extension_misc::UNLOAD_REASON_UNINSTALL) { diff --git a/chrome/browser/automation/automation_extension_tracker.h b/chrome/browser/automation/automation_extension_tracker.h index 92b02ec..c8bf295 100644 --- a/chrome/browser/automation/automation_extension_tracker.h +++ b/chrome/browser/automation/automation_extension_tracker.h @@ -33,8 +33,8 @@ class AutomationExtensionTracker // This is not true for the relevant extension notifications, so we have to // the observation ourselves. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index c367584..7728b8e 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -28,7 +28,7 @@ #include "content/browser/browser_thread.h" #include "content/browser/cancelable_request.h" #include "content/browser/tab_contents/navigation_entry.h" -#include "content/common/notification_observer.h" +#include "content/public/browser/notification_observer.h" #include "ipc/ipc_channel.h" #if defined(OS_WIN) && !defined(USE_AURA) @@ -374,8 +374,8 @@ class AutomationProvider #endif // defined(OS_WIN) && !defined(USE_AURA) scoped_ptr<IPC::ChannelProxy> channel_; - scoped_ptr<NotificationObserver> new_tab_ui_load_observer_; - scoped_ptr<NotificationObserver> find_in_page_observer_; + scoped_ptr<content::NotificationObserver> new_tab_ui_load_observer_; + scoped_ptr<content::NotificationObserver> find_in_page_observer_; scoped_ptr<ExtensionTestResultNotificationObserver> extension_test_result_observer_; scoped_ptr<AutomationExtensionTracker> extension_tracker_; diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index c0232ab..2e6a373 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -122,8 +122,8 @@ InitialLoadObserver::~InitialLoadObserver() { } void InitialLoadObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_START) { if (outstanding_tab_count_ > loading_tabs_.size()) loading_tabs_.insert(TabTimeMap::value_type( @@ -139,7 +139,8 @@ void InitialLoadObserver::Observe(int type, } } else if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) { base::TerminationStatus status = - Details<RenderProcessHost::RendererClosedDetails>(details)->status; + content::Details<RenderProcessHost::RendererClosedDetails>(details)-> + status; switch (status) { case base::TERMINATION_STATUS_NORMAL_TERMINATION: break; @@ -201,17 +202,17 @@ NewTabUILoadObserver::NewTabUILoadObserver(AutomationProvider* automation, Profile* profile) : automation_(automation->AsWeakPtr()) { registrar_.Add(this, chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, - Source<Profile>(profile)); + content::Source<Profile>(profile)); } NewTabUILoadObserver::~NewTabUILoadObserver() { } void NewTabUILoadObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD) { - Details<int> load_time(details); + content::Details<int> load_time(details); if (automation_) { automation_->Send( new AutomationMsg_InitialNewTabUILoadComplete(*load_time.ptr())); @@ -240,8 +241,8 @@ NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() { } void NavigationControllerRestoredObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (FinishedRestoring()) { SendDone(); registrar_.RemoveAll(); @@ -276,7 +277,7 @@ NavigationNotificationObserver::NavigationNotificationObserver( navigation_started_(false), use_json_interface_(use_json_interface) { DCHECK_LT(0, navigations_remaining_); - Source<NavigationController> source(controller_); + content::Source<NavigationController> source(controller_); registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); registrar_.Add(this, content::NOTIFICATION_LOAD_START, source); registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); @@ -294,8 +295,8 @@ NavigationNotificationObserver::~NavigationNotificationObserver() { } void NavigationNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -330,7 +331,7 @@ void NavigationNotificationObserver::Observe( // We do this in all cases (not just when navigation_started_ == true) so // tests can still wait for auth dialogs outside of navigation. LoginHandler* handler = - Details<LoginNotificationDetails>(details)->handler(); + content::Details<LoginNotificationDetails>(details)->handler(); automation_->AddLoginHandler(controller_, handler); // Respond that authentication is needed. @@ -371,14 +372,17 @@ TabStripNotificationObserver::TabStripNotificationObserver( TabStripNotificationObserver::~TabStripNotificationObserver() { } -void TabStripNotificationObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void TabStripNotificationObserver::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == notification_) { - if (type == content::NOTIFICATION_TAB_PARENTED) - ObserveTab(&(Source<TabContentsWrapper>(source).ptr()->controller())); - else - ObserveTab(Source<NavigationController>(source).ptr()); + if (type == content::NOTIFICATION_TAB_PARENTED) { + ObserveTab( + &(content::Source<TabContentsWrapper>(source).ptr()->controller())); + } else { + ObserveTab(content::Source<NavigationController>(source).ptr()); + } delete this; } else { NOTREACHED(); @@ -520,8 +524,8 @@ ExtensionUninstallObserver::~ExtensionUninstallObserver() { void ExtensionUninstallObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -529,7 +533,7 @@ void ExtensionUninstallObserver::Observe( switch (type) { case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { - if (id_ == *Details<const std::string>(details).ptr()) { + if (id_ == *content::Details<const std::string>(details).ptr()) { scoped_ptr<DictionaryValue> return_value(new DictionaryValue); return_value->SetBoolean("success", true); AutomationJSONReply(automation_, reply_message_.release()) @@ -541,7 +545,7 @@ void ExtensionUninstallObserver::Observe( } case chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED: { - const Extension* extension = Details<Extension>(details).ptr(); + const Extension* extension = content::Details<Extension>(details).ptr(); if (id_ == extension->id()) { scoped_ptr<DictionaryValue> return_value(new DictionaryValue); return_value->SetBoolean("success", false); @@ -583,8 +587,8 @@ ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() { } void ExtensionReadyNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -598,7 +602,7 @@ void ExtensionReadyNotificationObserver::Observe( return; break; case chrome::NOTIFICATION_EXTENSION_LOADED: - extension_ = Details<const Extension>(details).ptr(); + extension_ = content::Details<const Extension>(details).ptr(); if (!DidExtensionHostsStopLoading(manager_)) return; // For some reason, the background ExtensionHost is not yet @@ -645,8 +649,8 @@ ExtensionUnloadNotificationObserver::~ExtensionUnloadNotificationObserver() { } void ExtensionUnloadNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { did_receive_unload_notification_ = true; } else { @@ -679,8 +683,8 @@ ExtensionsUpdatedObserver::~ExtensionsUpdatedObserver() { } void ExtensionsUpdatedObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -698,7 +702,8 @@ void ExtensionsUpdatedObserver::Observe( switch (type) { case chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND: // Extension updater has identified an extension that needs to be updated. - in_progress_updates_.insert(*(Details<const std::string>(details).ptr())); + in_progress_updates_.insert( + *(content::Details<const std::string>(details).ptr())); break; case chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED: @@ -713,14 +718,14 @@ void ExtensionsUpdatedObserver::Observe( // An extension has either completed update installation and is now // loaded, or else the install has been skipped because it is // either not allowed or else has been disabled. - const Extension* extension = Details<Extension>(details).ptr(); + const Extension* extension = content::Details<Extension>(details).ptr(); in_progress_updates_.erase(extension->id()); break; } case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { // An extension had an error on update installation. - CrxInstaller* installer = Source<CrxInstaller>(source).ptr(); + CrxInstaller* installer = content::Source<CrxInstaller>(source).ptr(); in_progress_updates_.erase(installer->expected_id()); break; } @@ -761,8 +766,8 @@ ExtensionTestResultNotificationObserver:: } void ExtensionTestResultNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: results_.push_back(true); @@ -771,7 +776,7 @@ void ExtensionTestResultNotificationObserver::Observe( case chrome::NOTIFICATION_EXTENSION_TEST_FAILED: results_.push_back(false); - messages_.push_back(*Details<std::string>(details).ptr()); + messages_.push_back(*content::Details<std::string>(details).ptr()); break; default: @@ -818,8 +823,8 @@ BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() { } void BrowserOpenedNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -829,11 +834,11 @@ void BrowserOpenedNotificationObserver::Observe( // Store the new browser ID and continue waiting for a new tab within it // to stop loading. new_window_id_ = ExtensionTabUtil::GetWindowId( - Source<Browser>(source).ptr()); + content::Source<Browser>(source).ptr()); } else if (type == content::NOTIFICATION_LOAD_STOP) { // Only send the result if the loaded tab is in the new window. NavigationController* controller = - Source<NavigationController>(source).ptr(); + content::Source<NavigationController>(source).ptr(); TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( controller->tab_contents()); int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; @@ -864,14 +869,14 @@ BrowserClosedNotificationObserver::BrowserClosedNotificationObserver( reply_message_(reply_message), for_browser_command_(false) { registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, - Source<Browser>(browser)); + content::Source<Browser>(browser)); } BrowserClosedNotificationObserver::~BrowserClosedNotificationObserver() {} void BrowserClosedNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED); if (!automation_) { @@ -879,7 +884,7 @@ void BrowserClosedNotificationObserver::Observe( return; } - Details<bool> close_app(details); + content::Details<bool> close_app(details); if (for_browser_command_) { AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), @@ -915,8 +920,8 @@ BrowserCountChangeNotificationObserver:: void BrowserCountChangeNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_BROWSER_OPENED || type == chrome::NOTIFICATION_BROWSER_CLOSED); int current_count = static_cast<int>(BrowserList::size()); @@ -952,8 +957,8 @@ AppModalDialogShownObserver::~AppModalDialogShownObserver() { } void AppModalDialogShownObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN); if (automation_) { @@ -1045,8 +1050,8 @@ bool ExecuteBrowserCommandObserver::CreateAndRegisterObserver( } void ExecuteBrowserCommandObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == notification_type_) { if (automation_) { AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), @@ -1096,16 +1101,16 @@ FindInPageNotificationObserver::FindInPageNotificationObserver( reply_with_json_(reply_with_json), reply_message_(reply_message) { registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, - Source<TabContents>(parent_tab)); + content::Source<TabContents>(parent_tab)); } FindInPageNotificationObserver::~FindInPageNotificationObserver() { } void FindInPageNotificationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { - Details<FindNotificationDetails> find_details(details); + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { + content::Details<FindNotificationDetails> find_details(details); if (!(find_details->final_update() && reply_message_ != NULL)) { DVLOG(1) << "Ignoring, since we only care about the final message"; return; @@ -1160,10 +1165,10 @@ DomOperationObserver::DomOperationObserver() { DomOperationObserver::~DomOperationObserver() {} void DomOperationObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE) { - Details<DomOperationNotificationDetails> dom_op_details(details); + content::Details<DomOperationNotificationDetails> dom_op_details(details); OnDomOperationCompleted(dom_op_details->json()); } else if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) { OnModalDialogShown(); @@ -1224,10 +1229,10 @@ DocumentPrintedNotificationObserver::~DocumentPrintedNotificationObserver() { void DocumentPrintedNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_PRINT_JOB_EVENT); - switch (Details<printing::JobEventDetails>(details)->type()) { + switch (content::Details<printing::JobEventDetails>(details)->type()) { case printing::JobEventDetails::JOB_DONE: { // Succeeded. success_ = true; @@ -1272,14 +1277,16 @@ int MetricEventDurationObserver::GetEventDurationMs( return it->second; } -void MetricEventDurationObserver::Observe(int type, - const NotificationSource& source, const NotificationDetails& details) { +void MetricEventDurationObserver::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type != chrome::NOTIFICATION_METRIC_EVENT_DURATION) { NOTREACHED(); return; } MetricEventDurationDetails* metric_event_duration = - Details<MetricEventDurationDetails>(details).ptr(); + content::Details<MetricEventDurationDetails>(details).ptr(); durations_[metric_event_duration->event_name] = metric_event_duration->duration_ms; } @@ -1290,14 +1297,15 @@ PageTranslatedObserver::PageTranslatedObserver(AutomationProvider* automation, : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { registrar_.Add(this, chrome::NOTIFICATION_PAGE_TRANSLATED, - Source<TabContents>(tab_contents)); + content::Source<TabContents>(tab_contents)); } PageTranslatedObserver::~PageTranslatedObserver() {} -void PageTranslatedObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void PageTranslatedObserver::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -1307,7 +1315,7 @@ void PageTranslatedObserver::Observe(int type, AutomationJSONReply reply(automation_, reply_message_.release()); PageTranslatedDetails* translated_details = - Details<PageTranslatedDetails>(details).ptr(); + content::Details<PageTranslatedDetails>(details).ptr(); scoped_ptr<DictionaryValue> return_value(new DictionaryValue); return_value->SetBoolean( "translation_success", @@ -1324,14 +1332,14 @@ TabLanguageDeterminedObserver::TabLanguageDeterminedObserver( tab_contents_(tab_contents), translate_bar_(translate_bar) { registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, - Source<TabContents>(tab_contents)); + content::Source<TabContents>(tab_contents)); } TabLanguageDeterminedObserver::~TabLanguageDeterminedObserver() {} void TabLanguageDeterminedObserver::Observe( - int type, const NotificationSource& source, - const NotificationDetails& details) { + int type, const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED); if (!automation_) { @@ -1389,7 +1397,7 @@ InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, reply_message_(reply_message), tab_contents_(tab_contents), target_count_(target_count) { - Source<InfoBarTabHelper> source(tab_contents->infobar_tab_helper()); + content::Source<InfoBarTabHelper> source(tab_contents->infobar_tab_helper()); registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, source); registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, @@ -1399,9 +1407,10 @@ InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, InfoBarCountObserver::~InfoBarCountObserver() {} -void InfoBarCountObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void InfoBarCountObserver::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED || type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED); CheckCount(); @@ -1752,12 +1761,12 @@ void PasswordStoreLoginsChangedObserver::RegisterObserversTask() { void PasswordStoreLoginsChangedObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); DCHECK(type == chrome::NOTIFICATION_LOGINS_CHANGED); PasswordStoreChangeList* change_details = - Details<PasswordStoreChangeList>(details).ptr(); + content::Details<PasswordStoreChangeList>(details).ptr(); if (change_details->size() != 1 || change_details->front().type() != expected_type_) { // Notify the UI thread that there's an error. @@ -1826,7 +1835,7 @@ OmniboxAcceptNotificationObserver::OmniboxAcceptNotificationObserver( : automation_(automation->AsWeakPtr()), reply_message_(reply_message), controller_(controller) { - Source<NavigationController> source(controller_); + content::Source<NavigationController> source(controller_); registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); // Pages requiring auth don't send LOAD_STOP. registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); @@ -1837,8 +1846,8 @@ OmniboxAcceptNotificationObserver::~OmniboxAcceptNotificationObserver() { void OmniboxAcceptNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_STOP || type == chrome::NOTIFICATION_AUTH_NEEDED) { if (automation_) { @@ -1857,7 +1866,7 @@ SavePackageNotificationObserver::SavePackageNotificationObserver( IPC::Message* reply_message) : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { - Source<DownloadManager> source(download_manager); + content::Source<DownloadManager> source(download_manager); registrar_.Add(this, content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, source); } @@ -1866,8 +1875,8 @@ SavePackageNotificationObserver::~SavePackageNotificationObserver() {} void SavePackageNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED) { if (automation_) { AutomationJSONReply(automation_, @@ -2105,24 +2114,25 @@ NTPInfoObserver::NTPInfoObserver( ntp_info_->Set("default_sites", default_sites_list); registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_UPDATED, - Source<history::TopSites>(top_sites_)); + content::Source<history::TopSites>(top_sites_)); if (top_sites_->loaded()) { OnTopSitesLoaded(); } else { registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_LOADED, - Source<Profile>(automation_->profile())); + content::Source<Profile>(automation_->profile())); } } NTPInfoObserver::~NTPInfoObserver() {} void NTPInfoObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_TOP_SITES_LOADED) { OnTopSitesLoaded(); } else if (type == chrome::NOTIFICATION_TOP_SITES_UPDATED) { - Details<CancelableRequestProvider::Handle> request_details(details); + content::Details<CancelableRequestProvider::Handle> request_details( + details); if (request_ == *request_details.ptr()) { top_sites_->GetMostVisitedURLs( consumer_, @@ -2172,7 +2182,7 @@ AppLaunchObserver::AppLaunchObserver( new_window_id_(extension_misc::kUnknownWindowId) { if (launch_container_ == extension_misc::LAUNCH_TAB) { // Need to wait for the currently-active tab to reload. - Source<NavigationController> source(controller_); + content::Source<NavigationController> source(controller_); registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); } else { // Need to wait for a new tab in a new window to load. @@ -2186,8 +2196,8 @@ AppLaunchObserver::AppLaunchObserver( AppLaunchObserver::~AppLaunchObserver() {} void AppLaunchObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_STOP) { if (launch_container_ == extension_misc::LAUNCH_TAB) { // The app has been launched in the new tab. @@ -2200,7 +2210,7 @@ void AppLaunchObserver::Observe(int type, } else { // The app has launched only if the loaded tab is in the new window. NavigationController* controller = - Source<NavigationController>(source).ptr(); + content::Source<NavigationController>(source).ptr(); TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( controller->tab_contents()); @@ -2216,7 +2226,7 @@ void AppLaunchObserver::Observe(int type, } } else if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { new_window_id_ = ExtensionTabUtil::GetWindowId( - Source<Browser>(source).ptr()); + content::Source<Browser>(source).ptr()); } else { NOTREACHED(); } @@ -2231,7 +2241,7 @@ AutofillDisplayedObserver::AutofillDisplayedObserver( render_view_host_(render_view_host), automation_(automation->AsWeakPtr()), reply_message_(reply_message) { - Source<RenderViewHost> source(render_view_host_); + content::Source<RenderViewHost> source(render_view_host_); registrar_.Add(this, notification_, source); } @@ -2239,10 +2249,10 @@ AutofillDisplayedObserver::~AutofillDisplayedObserver() {} void AutofillDisplayedObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK_EQ(type, notification_); - DCHECK_EQ(Source<RenderViewHost>(source).ptr(), render_view_host_); + DCHECK_EQ(content::Source<RenderViewHost>(source).ptr(), render_view_host_); if (automation_) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -2288,8 +2298,8 @@ void AutofillChangedObserver::RegisterObserversTask() { void AutofillChangedObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); if (type == chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED) { @@ -2364,12 +2374,12 @@ void AutofillFormSubmittedObserver::OnInsufficientFormData() { void AutofillFormSubmittedObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED); // Accept in the infobar. - infobar_helper_ = Source<InfoBarTabHelper>(source).ptr(); + infobar_helper_ = content::Source<InfoBarTabHelper>(source).ptr(); InfoBarDelegate* infobar = NULL; infobar = infobar_helper_->GetInfoBarDelegateAt(0); @@ -2429,8 +2439,8 @@ GetAllNotificationsObserver::~GetAllNotificationsObserver() {} void GetAllNotificationsObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -2523,8 +2533,8 @@ OnNotificationBalloonCountObserver::~OnNotificationBalloonCountObserver() { void OnNotificationBalloonCountObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { CheckBalloonCount(); } @@ -2556,8 +2566,8 @@ RendererProcessClosedObserver::~RendererProcessClosedObserver() {} void RendererProcessClosedObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (automation_) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -2589,8 +2599,8 @@ InputEventAckNotificationObserver::~InputEventAckNotificationObserver() {} void InputEventAckNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -2598,7 +2608,7 @@ void InputEventAckNotificationObserver::Observe( return; } - Details<int> request_details(details); + content::Details<int> request_details(details); // If the event type matches for |count_| times, replies with a JSON message. if (event_type_ == *request_details.ptr()) { if (--count_ == 0 && automation_) { @@ -2663,8 +2673,8 @@ void AllTabsStoppedLoadingObserver::OnNoMorePendingLoads( void AllTabsStoppedLoadingObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -2696,11 +2706,11 @@ NewTabObserver::NewTabObserver(AutomationProvider* automation, } void NewTabObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); NavigationController* controller = - &(Source<TabContentsWrapper>(source).ptr()->controller()); + &(content::Source<TabContentsWrapper>(source).ptr()->controller()); if (automation_) { // TODO(phajdan.jr): Clean up this hack. We write the correct return type // here, but don't send the message. NavigationNotificationObserver @@ -2784,8 +2794,8 @@ DragTargetDropAckNotificationObserver:: void DragTargetDropAckNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (automation_) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -2895,8 +2905,8 @@ BrowserOpenedWithNewProfileNotificationObserver:: void BrowserOpenedWithNewProfileNotificationObserver::Observe( int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (!automation_) { delete this; return; @@ -2905,7 +2915,7 @@ void BrowserOpenedWithNewProfileNotificationObserver::Observe( if (type == chrome::NOTIFICATION_PROFILE_CREATED) { // As part of multi-profile creation, a new browser window will // automatically be opened. - Profile* profile = Source<Profile>(source).ptr(); + Profile* profile = content::Source<Profile>(source).ptr(); if (!profile) { AutomationJSONReply(automation_, reply_message_.release()).SendError("Profile could not be created."); @@ -2915,11 +2925,11 @@ void BrowserOpenedWithNewProfileNotificationObserver::Observe( // Store the new browser ID and continue waiting for a new tab within it // to stop loading. new_window_id_ = ExtensionTabUtil::GetWindowId( - Source<Browser>(source).ptr()); + content::Source<Browser>(source).ptr()); } else if (type == content::NOTIFICATION_LOAD_STOP) { // Only send the result if the loaded tab is in the new window. NavigationController* controller = - Source<NavigationController>(source).ptr(); + content::Source<NavigationController>(source).ptr(); TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( controller->tab_contents()); int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index 5eed00a..66ba758 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -49,8 +49,8 @@ #include "content/browser/cancelable_request.h" #include "content/browser/download/download_item.h" #include "content/browser/download/download_manager.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_types.h" #include "ui/gfx/size.h" @@ -84,14 +84,14 @@ namespace IPC { class Message; } -class InitialLoadObserver : public NotificationObserver { +class InitialLoadObserver : public content::NotificationObserver { public: InitialLoadObserver(size_t tab_count, AutomationProvider* automation); virtual ~InitialLoadObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); // Caller owns the return value and is responsible for deleting it. // Example return value: @@ -109,7 +109,7 @@ class InitialLoadObserver : public NotificationObserver { void ConditionMet(); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; size_t crashed_tab_count_; @@ -139,16 +139,16 @@ class NetworkManagerInitObserver }; // Observes when webui login becomes ready on chromeos. -class LoginWebuiReadyObserver : public NotificationObserver { +class LoginWebuiReadyObserver : public content::NotificationObserver { public: explicit LoginWebuiReadyObserver(AutomationProvider* automation); virtual ~LoginWebuiReadyObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; DISALLOW_COPY_AND_ASSIGN(LoginWebuiReadyObserver); @@ -156,24 +156,25 @@ class LoginWebuiReadyObserver : public NotificationObserver { #endif // defined(OS_CHROMEOS) // Watches for NewTabUI page loads for performance timing purposes. -class NewTabUILoadObserver : public NotificationObserver { +class NewTabUILoadObserver : public content::NotificationObserver { public: explicit NewTabUILoadObserver(AutomationProvider* automation, Profile* profile); virtual ~NewTabUILoadObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; DISALLOW_COPY_AND_ASSIGN(NewTabUILoadObserver); }; -class NavigationControllerRestoredObserver : public NotificationObserver { +class NavigationControllerRestoredObserver + : public content::NotificationObserver { public: NavigationControllerRestoredObserver(AutomationProvider* automation, NavigationController* controller, @@ -181,14 +182,14 @@ class NavigationControllerRestoredObserver : public NotificationObserver { virtual ~NavigationControllerRestoredObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: bool FinishedRestoring(); void SendDone(); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; NavigationController* controller_; scoped_ptr<IPC::Message> reply_message_; @@ -196,7 +197,7 @@ class NavigationControllerRestoredObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(NavigationControllerRestoredObserver); }; -class NavigationNotificationObserver : public NotificationObserver { +class NavigationNotificationObserver : public content::NotificationObserver { public: NavigationNotificationObserver(NavigationController* controller, AutomationProvider* automation, @@ -207,13 +208,13 @@ class NavigationNotificationObserver : public NotificationObserver { virtual ~NavigationNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: void ConditionMet(AutomationMsg_NavigationResponseValues navigation_result); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; NavigationController* controller_; @@ -224,20 +225,20 @@ class NavigationNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver); }; -class TabStripNotificationObserver : public NotificationObserver { +class TabStripNotificationObserver : public content::NotificationObserver { public: TabStripNotificationObserver(int notification, AutomationProvider* automation); virtual ~TabStripNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); virtual void ObserveTab(NavigationController* controller) = 0; protected: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; int notification_; }; @@ -310,20 +311,20 @@ class TabCountChangeObserver : public TabStripModelObserver { }; // Observes when an extension has been uninstalled. -class ExtensionUninstallObserver : public NotificationObserver { +class ExtensionUninstallObserver : public content::NotificationObserver { public: ExtensionUninstallObserver(AutomationProvider* automation, IPC::Message* reply_message, const std::string& id); virtual ~ExtensionUninstallObserver(); - // Implementation of NotificationObserver. + // Implementation of content::NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; std::string id_; @@ -333,7 +334,8 @@ class ExtensionUninstallObserver : public NotificationObserver { // Observes when an extension has finished loading and is ready for use. Also // checks for possible install errors. -class ExtensionReadyNotificationObserver : public NotificationObserver { +class ExtensionReadyNotificationObserver + : public content::NotificationObserver { public: ExtensionReadyNotificationObserver(ExtensionProcessManager* manager, ExtensionService* service, @@ -344,11 +346,11 @@ class ExtensionReadyNotificationObserver : public NotificationObserver { // Implementation of NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; ExtensionProcessManager* manager_; ExtensionService* service_; base::WeakPtr<AutomationProvider> automation_; @@ -359,22 +361,23 @@ class ExtensionReadyNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(ExtensionReadyNotificationObserver); }; -class ExtensionUnloadNotificationObserver : public NotificationObserver { +class ExtensionUnloadNotificationObserver + : public content::NotificationObserver { public: ExtensionUnloadNotificationObserver(); virtual ~ExtensionUnloadNotificationObserver(); // Implementation of NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); bool did_receive_unload_notification() { return did_receive_unload_notification_; } private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; bool did_receive_unload_notification_; DISALLOW_COPY_AND_ASSIGN(ExtensionUnloadNotificationObserver); @@ -384,7 +387,7 @@ class ExtensionUnloadNotificationObserver : public NotificationObserver { // service provides notifications for each extension that gets updated, but // it does not wait for the updated extensions to be installed or loaded. This // observer waits until all updated extensions have actually been loaded. -class ExtensionsUpdatedObserver : public NotificationObserver { +class ExtensionsUpdatedObserver : public content::NotificationObserver { public: ExtensionsUpdatedObserver(ExtensionProcessManager* manager, AutomationProvider* automation, @@ -393,11 +396,11 @@ class ExtensionsUpdatedObserver : public NotificationObserver { // Implementation of NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; ExtensionProcessManager* manager_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -407,7 +410,8 @@ class ExtensionsUpdatedObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(ExtensionsUpdatedObserver); }; -class ExtensionTestResultNotificationObserver : public NotificationObserver { +class ExtensionTestResultNotificationObserver + : public content::NotificationObserver { public: explicit ExtensionTestResultNotificationObserver( AutomationProvider* automation); @@ -415,15 +419,15 @@ class ExtensionTestResultNotificationObserver : public NotificationObserver { // Implementation of NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); // Sends a test result back to the provider's client, if there is a pending // provider message and there is a result in the queue. void MaybeSendResult(); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; // Two queues containing the test results. Although typically only // one result will be in each queue, there are cases where a queue is @@ -440,20 +444,20 @@ class ExtensionTestResultNotificationObserver : public NotificationObserver { // Observes when a new browser has been opened and a tab within it has stopped // loading. -class BrowserOpenedNotificationObserver : public NotificationObserver { +class BrowserOpenedNotificationObserver : public content::NotificationObserver { public: BrowserOpenedNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual ~BrowserOpenedNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); void set_for_browser_command(bool for_browser_command); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; int new_window_id_; @@ -462,7 +466,7 @@ class BrowserOpenedNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(BrowserOpenedNotificationObserver); }; -class BrowserClosedNotificationObserver : public NotificationObserver { +class BrowserClosedNotificationObserver : public content::NotificationObserver { public: BrowserClosedNotificationObserver(Browser* browser, AutomationProvider* automation, @@ -470,13 +474,13 @@ class BrowserClosedNotificationObserver : public NotificationObserver { virtual ~BrowserClosedNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); void set_for_browser_command(bool for_browser_command); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; bool for_browser_command_; @@ -484,7 +488,8 @@ class BrowserClosedNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(BrowserClosedNotificationObserver); }; -class BrowserCountChangeNotificationObserver : public NotificationObserver { +class BrowserCountChangeNotificationObserver + : public content::NotificationObserver { public: BrowserCountChangeNotificationObserver(int target_count, AutomationProvider* automation, @@ -492,37 +497,37 @@ class BrowserCountChangeNotificationObserver : public NotificationObserver { virtual ~BrowserCountChangeNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: int target_count_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; DISALLOW_COPY_AND_ASSIGN(BrowserCountChangeNotificationObserver); }; -class AppModalDialogShownObserver : public NotificationObserver { +class AppModalDialogShownObserver : public content::NotificationObserver { public: AppModalDialogShownObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual ~AppModalDialogShownObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; DISALLOW_COPY_AND_ASSIGN(AppModalDialogShownObserver); }; -class ExecuteBrowserCommandObserver : public NotificationObserver { +class ExecuteBrowserCommandObserver : public content::NotificationObserver { public: virtual ~ExecuteBrowserCommandObserver(); @@ -532,8 +537,8 @@ class ExecuteBrowserCommandObserver : public NotificationObserver { IPC::Message* reply_message); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: ExecuteBrowserCommandObserver(AutomationProvider* automation, @@ -543,7 +548,7 @@ class ExecuteBrowserCommandObserver : public NotificationObserver { bool Getint(int command, int* type); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; int notification_type_; scoped_ptr<IPC::Message> reply_message_; @@ -551,7 +556,7 @@ class ExecuteBrowserCommandObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(ExecuteBrowserCommandObserver); }; -class FindInPageNotificationObserver : public NotificationObserver { +class FindInPageNotificationObserver : public content::NotificationObserver { public: FindInPageNotificationObserver(AutomationProvider* automation, TabContents* parent_tab, @@ -560,8 +565,8 @@ class FindInPageNotificationObserver : public NotificationObserver { virtual ~FindInPageNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); // The Find mechanism is over asynchronous IPC, so a search is kicked off and // we wait for notification to find out what the results are. As the user is @@ -573,7 +578,7 @@ class FindInPageNotificationObserver : public NotificationObserver { static const int kFindInPageRequestId; private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; // We will at some point (before final update) be notified of the ordinal and // we need to preserve it so we can send it later. @@ -585,20 +590,20 @@ class FindInPageNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver); }; -class DomOperationObserver : public NotificationObserver { +class DomOperationObserver : public content::NotificationObserver { public: DomOperationObserver(); virtual ~DomOperationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; virtual void OnDomOperationCompleted(const std::string& json) = 0; virtual void OnModalDialogShown() = 0; private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(DomOperationObserver); }; @@ -623,17 +628,18 @@ class DomOperationMessageSender : public DomOperationObserver { DISALLOW_COPY_AND_ASSIGN(DomOperationMessageSender); }; -class DocumentPrintedNotificationObserver : public NotificationObserver { +class DocumentPrintedNotificationObserver + : public content::NotificationObserver { public: DocumentPrintedNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual ~DocumentPrintedNotificationObserver(); - virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details); + virtual void Observe(int type, const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; bool success_; scoped_ptr<IPC::Message> reply_message_; @@ -642,7 +648,7 @@ class DocumentPrintedNotificationObserver : public NotificationObserver { }; // Collects METRIC_EVENT_DURATION notifications and keep track of the times. -class MetricEventDurationObserver : public NotificationObserver { +class MetricEventDurationObserver : public content::NotificationObserver { public: MetricEventDurationObserver(); virtual ~MetricEventDurationObserver(); @@ -651,11 +657,11 @@ class MetricEventDurationObserver : public NotificationObserver { int GetEventDurationMs(const std::string& event_name); // NotificationObserver interface. - virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details); + virtual void Observe(int type, const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; typedef std::map<std::string, int> EventDurationMap; EventDurationMap durations_; @@ -663,27 +669,27 @@ class MetricEventDurationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver); }; -class PageTranslatedObserver : public NotificationObserver { +class PageTranslatedObserver : public content::NotificationObserver { public: PageTranslatedObserver(AutomationProvider* automation, IPC::Message* reply_message, TabContents* tab_contents); virtual ~PageTranslatedObserver(); - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; DISALLOW_COPY_AND_ASSIGN(PageTranslatedObserver); }; -class TabLanguageDeterminedObserver : public NotificationObserver { +class TabLanguageDeterminedObserver : public content::NotificationObserver { public: TabLanguageDeterminedObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -691,13 +697,13 @@ class TabLanguageDeterminedObserver : public NotificationObserver { TranslateInfoBarDelegate* translate_bar); virtual ~TabLanguageDeterminedObserver(); - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; TabContents* tab_contents_; @@ -706,7 +712,7 @@ class TabLanguageDeterminedObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver); }; -class InfoBarCountObserver : public NotificationObserver { +class InfoBarCountObserver : public content::NotificationObserver { public: InfoBarCountObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -714,17 +720,17 @@ class InfoBarCountObserver : public NotificationObserver { size_t target_count); virtual ~InfoBarCountObserver(); - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: // Checks whether the infobar count matches our target, and if so // sends the reply message and deletes itself. void CheckCount(); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; TabContentsWrapper* tab_contents_; @@ -762,7 +768,7 @@ class LoginObserver : public chromeos::LoginStatusConsumer { // Collects SCREEN_LOCK_STATE_CHANGED notifications and returns // whether authentication succeeded to the automation provider. -class ScreenLockUnlockObserver : public NotificationObserver { +class ScreenLockUnlockObserver : public content::NotificationObserver { public: // Set lock_screen to true to observe lock screen events, // false for unlock screen events. @@ -771,16 +777,16 @@ class ScreenLockUnlockObserver : public NotificationObserver { bool lock_screen); virtual ~ScreenLockUnlockObserver(); - // NotificationObserver interface. - virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details); + // content::NotificationObserver interface. + virtual void Observe(int type, const content::NotificationSource& source, + const content::NotificationDetails& details); protected: base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; bool lock_screen_; DISALLOW_COPY_AND_ASSIGN(ScreenLockUnlockObserver); @@ -1236,7 +1242,7 @@ class PasswordStoreLoginsChangedObserver : public base::RefCountedThreadSafe< PasswordStoreLoginsChangedObserver, BrowserThread::DeleteOnUIThread>, - public NotificationObserver { + public content::NotificationObserver { public: PasswordStoreLoginsChangedObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -1247,10 +1253,10 @@ class PasswordStoreLoginsChangedObserver // Schedules a task on the DB thread to register the appropriate observers. virtual void Init(); - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; @@ -1268,7 +1274,7 @@ class PasswordStoreLoginsChangedObserver base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; PasswordStoreChange::Type expected_type_; std::string result_key_; @@ -1297,7 +1303,7 @@ class AutomationProviderBrowsingDataObserver // Allows automation provider to wait until page load after selecting an item // in the omnibox popup. -class OmniboxAcceptNotificationObserver : public NotificationObserver { +class OmniboxAcceptNotificationObserver : public content::NotificationObserver { public: OmniboxAcceptNotificationObserver(NavigationController* controller, AutomationProvider* automation, @@ -1305,11 +1311,11 @@ class OmniboxAcceptNotificationObserver : public NotificationObserver { virtual ~OmniboxAcceptNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; NavigationController* controller_; @@ -1318,7 +1324,7 @@ class OmniboxAcceptNotificationObserver : public NotificationObserver { }; // Allows the automation provider to wait for a save package notification. -class SavePackageNotificationObserver : public NotificationObserver { +class SavePackageNotificationObserver : public content::NotificationObserver { public: SavePackageNotificationObserver(DownloadManager* download_manager, AutomationProvider* automation, @@ -1326,11 +1332,11 @@ class SavePackageNotificationObserver : public NotificationObserver { virtual ~SavePackageNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1375,7 +1381,7 @@ class PageSnapshotTaker : public DomOperationObserver { DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); }; -class NTPInfoObserver : public NotificationObserver { +class NTPInfoObserver : public content::NotificationObserver { public: NTPInfoObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -1383,8 +1389,8 @@ class NTPInfoObserver : public NotificationObserver { virtual ~NTPInfoObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: void OnTopSitesLoaded(); @@ -1396,14 +1402,14 @@ class NTPInfoObserver : public NotificationObserver { CancelableRequestProvider::Handle request_; scoped_ptr<base::DictionaryValue> ntp_info_; history::TopSites* top_sites_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(NTPInfoObserver); }; // Observes when an app has been launched, as indicated by a notification that // a content load in some tab has stopped. -class AppLaunchObserver : public NotificationObserver { +class AppLaunchObserver : public content::NotificationObserver { public: AppLaunchObserver(NavigationController* controller, AutomationProvider* automation, @@ -1412,14 +1418,14 @@ class AppLaunchObserver : public NotificationObserver { virtual ~AppLaunchObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: NavigationController* controller_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; extension_misc::LaunchContainer launch_container_; int new_window_id_; @@ -1431,7 +1437,7 @@ class AppLaunchObserver : public NotificationObserver { // has been shown in the renderer; (2) a webpage form is filled or previewed // with Autofill suggestions. A constructor argument specifies the appropriate // notification to wait for. -class AutofillDisplayedObserver : public NotificationObserver { +class AutofillDisplayedObserver : public content::NotificationObserver { public: AutofillDisplayedObserver(int notification, RenderViewHost* render_view_host, @@ -1439,17 +1445,17 @@ class AutofillDisplayedObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~AutofillDisplayedObserver(); - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: int notification_; RenderViewHost* render_view_host_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver); }; @@ -1461,7 +1467,7 @@ class AutofillChangedObserver : public base::RefCountedThreadSafe< AutofillChangedObserver, BrowserThread::DeleteOnUIThread>, - public NotificationObserver { + public content::NotificationObserver { public: AutofillChangedObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -1472,10 +1478,10 @@ class AutofillChangedObserver // Schedules a task on the DB thread to register the appropriate observers. virtual void Init(); - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; @@ -1490,7 +1496,7 @@ class AutofillChangedObserver base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; int num_profiles_; int num_credit_cards_; @@ -1507,7 +1513,7 @@ class AutofillChangedObserver // causes a confirm infobar to appear). class AutofillFormSubmittedObserver : public PersonalDataManagerObserver, - public NotificationObserver { + public content::NotificationObserver { public: AutofillFormSubmittedObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -1518,13 +1524,13 @@ class AutofillFormSubmittedObserver virtual void OnPersonalDataChanged() OVERRIDE; virtual void OnInsufficientFormData() OVERRIDE; - // NotificationObserver interface. + // content::NotificationObserver interface. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; PersonalDataManager* pdm_; @@ -1533,15 +1539,15 @@ class AutofillFormSubmittedObserver // Allows the automation provider to wait until all the notification // processes are ready. -class GetAllNotificationsObserver : public NotificationObserver { +class GetAllNotificationsObserver : public content::NotificationObserver { public: GetAllNotificationsObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual ~GetAllNotificationsObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: // Sends a message via the |AutomationProvider|. |automation_| must be valid. @@ -1559,17 +1565,17 @@ class GetAllNotificationsObserver : public NotificationObserver { // Allows the automation provider to wait for a new notification balloon // to appear and be ready. -class NewNotificationBalloonObserver : public NotificationObserver { +class NewNotificationBalloonObserver : public content::NotificationObserver { public: NewNotificationBalloonObserver(AutomationProvider* provider, IPC::Message* reply_message); virtual ~NewNotificationBalloonObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1578,7 +1584,8 @@ class NewNotificationBalloonObserver : public NotificationObserver { // Allows the automation provider to wait for a given number of // notification balloons. -class OnNotificationBalloonCountObserver : public NotificationObserver { +class OnNotificationBalloonCountObserver + : public content::NotificationObserver { public: OnNotificationBalloonCountObserver(AutomationProvider* provider, IPC::Message* reply_message, @@ -1591,11 +1598,11 @@ class OnNotificationBalloonCountObserver : public NotificationObserver { void CheckBalloonCount(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1607,18 +1614,18 @@ class OnNotificationBalloonCountObserver : public NotificationObserver { // Allows the automation provider to wait for a RENDERER_PROCESS_CLOSED // notification. -class RendererProcessClosedObserver : public NotificationObserver { +class RendererProcessClosedObserver : public content::NotificationObserver { public: RendererProcessClosedObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual ~RendererProcessClosedObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1627,7 +1634,7 @@ class RendererProcessClosedObserver : public NotificationObserver { // Allows the automation provider to wait for acknowledgement that a certain // type and number of input events has been processed by the renderer. -class InputEventAckNotificationObserver : public NotificationObserver { +class InputEventAckNotificationObserver : public content::NotificationObserver { public: InputEventAckNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message, @@ -1635,11 +1642,11 @@ class InputEventAckNotificationObserver : public NotificationObserver { virtual ~InputEventAckNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; int event_type_; @@ -1653,7 +1660,7 @@ class InputEventAckNotificationObserver : public NotificationObserver { // creation. Will send a message on construction if no tabs are loading // currently. class AllTabsStoppedLoadingObserver : public TabEventObserver, - public NotificationObserver { + public content::NotificationObserver { public: AllTabsStoppedLoadingObserver(AutomationProvider* automation, IPC::Message* reply_message); @@ -1663,10 +1670,10 @@ class AllTabsStoppedLoadingObserver : public TabEventObserver, virtual void OnFirstPendingLoad(TabContents* tab_contents) OVERRIDE; virtual void OnNoMorePendingLoads(TabContents* tab_contents) OVERRIDE; - // NotificationObserver implementation. + // content::NotificationObserver implementation. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; private: typedef std::set<TabContents*> TabSet; @@ -1676,7 +1683,7 @@ class AllTabsStoppedLoadingObserver : public TabEventObserver, void CheckIfNoMorePendingLoads(); TabSet pending_tabs_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1684,18 +1691,18 @@ class AllTabsStoppedLoadingObserver : public TabEventObserver, }; // Observer used to listen for new tab creation to complete. -class NewTabObserver : public NotificationObserver { +class NewTabObserver : public content::NotificationObserver { public: NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; private: virtual ~NewTabObserver(); - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1739,18 +1746,19 @@ class WaitForProcessLauncherThreadToGoIdleObserver // Allows the automation provider to wait for acknowledgement that a drop // operation has been processed by the renderer. -class DragTargetDropAckNotificationObserver : public NotificationObserver { +class DragTargetDropAckNotificationObserver + : public content::NotificationObserver { public: DragTargetDropAckNotificationObserver(AutomationProvider* automation, IPC::Message* reply_message); virtual ~DragTargetDropAckNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1782,7 +1790,7 @@ class ProcessInfoObserver : public MemoryDetails { // window creation, it creates a new tab and then finally observes it finish // loading. class BrowserOpenedWithNewProfileNotificationObserver - : public NotificationObserver { + : public content::NotificationObserver { public: BrowserOpenedWithNewProfileNotificationObserver( AutomationProvider* automation, @@ -1790,11 +1798,11 @@ class BrowserOpenedWithNewProfileNotificationObserver virtual ~BrowserOpenedWithNewProfileNotificationObserver(); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; int new_window_id_; diff --git a/chrome/browser/automation/automation_provider_observers_chromeos.cc b/chrome/browser/automation/automation_provider_observers_chromeos.cc index 7c7549b7..9f9636f 100644 --- a/chrome/browser/automation/automation_provider_observers_chromeos.cc +++ b/chrome/browser/automation/automation_provider_observers_chromeos.cc @@ -56,9 +56,10 @@ LoginWebuiReadyObserver::LoginWebuiReadyObserver( LoginWebuiReadyObserver::~LoginWebuiReadyObserver() { } -void LoginWebuiReadyObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void LoginWebuiReadyObserver::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_LOGIN_WEBUI_READY); automation_->OnLoginWebuiReady(); delete this; @@ -109,9 +110,10 @@ ScreenLockUnlockObserver::ScreenLockUnlockObserver( ScreenLockUnlockObserver::~ScreenLockUnlockObserver() {} -void ScreenLockUnlockObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void ScreenLockUnlockObserver::Observe( + int type, + const content::NotificationSource& source, + const NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED); if (automation_) { AutomationJSONReply reply(automation_, reply_message_.release()); diff --git a/chrome/browser/automation/automation_tab_helper_browsertest.cc b/chrome/browser/automation/automation_tab_helper_browsertest.cc index cb32281..1baff3c 100644 --- a/chrome/browser/automation/automation_tab_helper_browsertest.cc +++ b/chrome/browser/automation/automation_tab_helper_browsertest.cc @@ -19,32 +19,32 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_details.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_source.h" #include "net/base/net_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using testing::_; -class MockNotificationObserver : public NotificationObserver { +class MockNotificationObserver : public content::NotificationObserver { public: MockNotificationObserver() { } virtual ~MockNotificationObserver() { } MOCK_METHOD3(Observe, void(int type, - const NotificationSource& source, - const NotificationDetails& details)); + const content::NotificationSource& source, + const content::NotificationDetails& details)); - void Register(int type, const NotificationSource& source) { + void Register(int type, const content::NotificationSource& source) { registrar_.Add(this, type, source); } private: - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(MockNotificationObserver); }; diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h index bce1d6c..5cab11b 100644 --- a/chrome/browser/automation/automation_tab_tracker.h +++ b/chrome/browser/automation/automation_tab_tracker.h @@ -23,8 +23,8 @@ class AutomationTabTracker virtual void RemoveObserver(NavigationController* resource); virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); base::Time GetLastNavigationTime(int handle); diff --git a/chrome/browser/automation/automation_window_tracker.cc b/chrome/browser/automation/automation_window_tracker.cc index b2b2097..4724c833 100644 --- a/chrome/browser/automation/automation_window_tracker.cc +++ b/chrome/browser/automation/automation_window_tracker.cc @@ -17,10 +17,10 @@ AutomationWindowTracker::~AutomationWindowTracker() { void AutomationWindowTracker::AddObserver(gfx::NativeWindow resource) { registrar_.Add(this, chrome::NOTIFICATION_WINDOW_CLOSED, - Source<gfx::NativeWindow>(resource)); + content::Source<gfx::NativeWindow>(resource)); } void AutomationWindowTracker::RemoveObserver(gfx::NativeWindow resource) { registrar_.Remove(this, chrome::NOTIFICATION_WINDOW_CLOSED, - Source<gfx::NativeWindow>(resource)); + content::Source<gfx::NativeWindow>(resource)); } diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 5c6d88f..14f7d69 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -256,9 +256,10 @@ void TestingAutomationProvider::OnSourceProfilesLoaded() { import_settings_data_.first_run); } -void TestingAutomationProvider::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { +void TestingAutomationProvider::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_SESSION_END); // OnBrowserRemoved does a ReleaseLater. When session end is received we exit // before the task runs resulting in this object not being deleted. This @@ -499,7 +500,7 @@ void TestingAutomationProvider::AppendTab(int handle, const GURL& url, IPC::Message* reply_message) { int append_tab_response = -1; // -1 is the error code - NotificationObserver* observer = NULL; + content::NotificationObserver* observer = NULL; if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); @@ -1644,7 +1645,7 @@ void TestingAutomationProvider::PrintNow(int tab_handle, if (tab_contents) { FindAndActivateTab(tab); - NotificationObserver* observer = + content::NotificationObserver* observer = new DocumentPrintedNotificationObserver(this, reply_message); TabContentsWrapper* wrapper = @@ -4102,8 +4103,8 @@ void TestingAutomationProvider::GetTranslateInfo( std::string language = helper->language_state().original_language(); if (!language.empty()) { observer->Observe(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, - Source<TabContents>(tab_contents), - Details<std::string>(&language)); + content::Source<TabContents>(tab_contents), + content::Details<std::string>(&language)); } } diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 7cd9b59..9c8877b 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -17,7 +17,7 @@ #include "chrome/browser/importer/importer_list_observer.h" #include "chrome/browser/sync/profile_sync_service_harness.h" #include "chrome/browser/ui/browser_list.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_registrar.h" #include "content/public/common/page_type.h" #include "net/base/cert_status_flags.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" @@ -37,7 +37,7 @@ struct WebPluginInfo; class TestingAutomationProvider : public AutomationProvider, public BrowserList::Observer, public importer::ImporterListObserver, - public NotificationObserver { + public content::NotificationObserver { public: explicit TestingAutomationProvider(Profile* profile); @@ -68,10 +68,10 @@ class TestingAutomationProvider : public AutomationProvider, // importer::ImporterListObserver: virtual void OnSourceProfilesLoaded() OVERRIDE; - // NotificationObserver: + // content::NotificationObserver: virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; // IPC Message callbacks. void CloseBrowser(int handle, IPC::Message* reply_message); @@ -1402,7 +1402,7 @@ class TestingAutomationProvider : public AutomationProvider, // query in progress. HistoryService::Handle redirect_query_; - NotificationRegistrar registrar_; + content::NotificationRegistrar registrar_; // Used to enumerate browser profiles. scoped_refptr<ImporterList> importer_list_; |