diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 19:42:00 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 19:42:00 +0000 |
commit | 7e4468d50ab7c74fad98adcb847d82c5750f2a21 (patch) | |
tree | bcaecf049255d834e454b10512b241172109bd6f /chrome/browser/automation | |
parent | 2aa3de25c0bca5f7c06a89a100bb7cd50004b853 (diff) | |
download | chromium_src-7e4468d50ab7c74fad98adcb847d82c5750f2a21.zip chromium_src-7e4468d50ab7c74fad98adcb847d82c5750f2a21.tar.gz chromium_src-7e4468d50ab7c74fad98adcb847d82c5750f2a21.tar.bz2 |
FBTF: Move a bunch of code to the headers and remove includes.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/3412016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
19 files changed, 167 insertions, 98 deletions
diff --git a/chrome/browser/automation/automation_extension_function.cc b/chrome/browser/automation/automation_extension_function.cc index ce556be..2e72c6b 100644 --- a/chrome/browser/automation/automation_extension_function.cc +++ b/chrome/browser/automation/automation_extension_function.cc @@ -20,6 +20,9 @@ TabContents* AutomationExtensionFunction::api_handler_tab_ = NULL; AutomationExtensionFunction::PendingFunctionsMap AutomationExtensionFunction::pending_functions_; +AutomationExtensionFunction::AutomationExtensionFunction() { +} + void AutomationExtensionFunction::SetArgs(const ListValue* args) { // Need to JSON-encode for sending over the wire to the automation user. base::JSONWriter::Write(args, false, &args_); @@ -164,3 +167,6 @@ bool AutomationExtensionFunction::InterceptMessageFromExternalHost( return false; } + +AutomationExtensionFunction::~AutomationExtensionFunction() { +} diff --git a/chrome/browser/automation/automation_extension_function.h b/chrome/browser/automation/automation_extension_function.h index 828b0f4..275d3c9 100644 --- a/chrome/browser/automation/automation_extension_function.h +++ b/chrome/browser/automation/automation_extension_function.h @@ -21,7 +21,7 @@ class TabContents; // automation interface, so that extensions can be tested using UITests. class AutomationExtensionFunction : public AsyncExtensionFunction { public: - AutomationExtensionFunction() { } + AutomationExtensionFunction(); // ExtensionFunction implementation. virtual void SetArgs(const ListValue* args); @@ -59,7 +59,7 @@ class AutomationExtensionFunction : public AsyncExtensionFunction { const std::string& target); private: - ~AutomationExtensionFunction() {} + ~AutomationExtensionFunction(); // Weak reference, lifetime managed by the ExternalTabContainer instance // owning the TabContents in question. diff --git a/chrome/browser/automation/automation_extension_tracker.cc b/chrome/browser/automation/automation_extension_tracker.cc index 8f09e1f..cd816d3 100644 --- a/chrome/browser/automation/automation_extension_tracker.cc +++ b/chrome/browser/automation/automation_extension_tracker.cc @@ -20,6 +20,10 @@ AutomationExtensionTracker::AutomationExtensionTracker( AutomationExtensionTracker::~AutomationExtensionTracker() { } +void AutomationExtensionTracker::AddObserver(Extension* resource) {} + +void AutomationExtensionTracker::RemoveObserver(Extension* resource) {} + void AutomationExtensionTracker::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { diff --git a/chrome/browser/automation/automation_extension_tracker.h b/chrome/browser/automation/automation_extension_tracker.h index 8daaf7f..c1b7ed7 100644 --- a/chrome/browser/automation/automation_extension_tracker.h +++ b/chrome/browser/automation/automation_extension_tracker.h @@ -23,10 +23,10 @@ class AutomationExtensionTracker // extension, is the one who sends the notification about extension // uninstalls. Instead of using this method, one observer is added for all // extensions in the constructor. - virtual void AddObserver(Extension* resource) {} + virtual void AddObserver(Extension* resource); // See related comment above as to why this method is empty. - virtual void RemoveObserver(Extension* resource) {} + virtual void RemoveObserver(Extension* resource); // Overriding AutomationResourceTracker Observe. AutomationResourceTracker's // Observe expects the NotificationSource to be the object that is closing. diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 233a8c7..838fcd6 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -17,17 +17,18 @@ #include <vector> #include "base/basictypes.h" +#include "base/observer_list.h" #include "base/scoped_ptr.h" #include "chrome/browser/autofill/field_types.h" -#include "chrome/browser/browser_list.h" -#include "chrome/browser/history/history.h" +#include "chrome/browser/cancelable_request.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/content_settings.h" -#include "chrome/common/notification_registrar.h" +#include "chrome/common/notification_observer.h" #include "chrome/test/automation/automation_constants.h" #include "ipc/ipc_message.h" #include "ipc/ipc_channel.h" #if defined(OS_WIN) +#include "gfx/native_widget_types.h" #include "views/event.h" #endif // defined(OS_WIN) @@ -47,12 +48,15 @@ class AutomationExtensionTracker; class AutomationResourceMessageFilter; class AutomationTabTracker; class AutomationWindowTracker; +class Browser; class CreditCard; class DictionaryValue; +class DownloadItem; class Extension; class ExtensionPortContainer; class ExtensionTestResultNotificationObserver; class ExternalTabContainer; +class FilePath; class InitialLoadObserver; class ListValue; class LoginHandler; @@ -60,6 +64,8 @@ class MetricEventDurationObserver; class NavigationController; class NavigationControllerRestoredObserver; class Profile; +class RenderViewHost; +class TabContents; struct AutocompleteMatchData; namespace gfx { diff --git a/chrome/browser/automation/automation_provider_json.cc b/chrome/browser/automation/automation_provider_json.cc index 05f3a1b..2ffbeaa 100644 --- a/chrome/browser/automation/automation_provider_json.cc +++ b/chrome/browser/automation/automation_provider_json.cc @@ -6,6 +6,7 @@ #include "base/json/json_writer.h" #include "base/json/string_escape.h" +#include "chrome/browser/automation/automation_provider.h" #include "chrome/test/automation/automation_messages.h" namespace { diff --git a/chrome/browser/automation/automation_provider_json.h b/chrome/browser/automation/automation_provider_json.h index 692af80..26b8581 100644 --- a/chrome/browser/automation/automation_provider_json.h +++ b/chrome/browser/automation/automation_provider_json.h @@ -10,9 +10,8 @@ #include <string> -#include "chrome/browser/automation/automation_provider.h" - class Value; +class AutomationProvider; namespace IPC { class Message; diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index a885a4f..f927c50 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -11,6 +11,8 @@ #include "chrome/browser/automation/automation_provider.h" #include "chrome/browser/automation/automation_provider_json.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/browser_list.h" #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/download/download_item.h" #include "chrome/browser/download/save_package.h" @@ -1109,7 +1111,8 @@ void LoginManagerObserver::Observe(NotificationType type, } #endif -AutomationProviderBookmarkModelObserver::AutomationProviderBookmarkModelObserver( +AutomationProviderBookmarkModelObserver:: +AutomationProviderBookmarkModelObserver( AutomationProvider* provider, IPC::Message* reply_message, BookmarkModel* model) { @@ -1119,7 +1122,8 @@ AutomationProviderBookmarkModelObserver::AutomationProviderBookmarkModelObserver model_->AddObserver(this); } -AutomationProviderBookmarkModelObserver::~AutomationProviderBookmarkModelObserver() { +AutomationProviderBookmarkModelObserver:: +~AutomationProviderBookmarkModelObserver() { model_->RemoveObserver(this); } diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index 5f9bbcf..949a594 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -20,7 +20,6 @@ #include "chrome/browser/importer/importer_data_types.h" #include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/search_engines/template_url_model_observer.h" -#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" diff --git a/chrome/browser/automation/automation_resource_tracker.cc b/chrome/browser/automation/automation_resource_tracker.cc index de20ba1..c233b41 100644 --- a/chrome/browser/automation/automation_resource_tracker.cc +++ b/chrome/browser/automation/automation_resource_tracker.cc @@ -7,6 +7,14 @@ #include "chrome/common/notification_service.h" #include "chrome/test/automation/automation_messages.h" +AutomationResourceTrackerImpl::AutomationResourceTrackerImpl( + IPC::Message::Sender* sender) + : sender_(sender) { +} + +AutomationResourceTrackerImpl::~AutomationResourceTrackerImpl() { +} + int AutomationResourceTrackerImpl::AddImpl(void* resource) { if (ContainsResourceImpl(resource)) return resource_to_handle_[resource]; diff --git a/chrome/browser/automation/automation_resource_tracker.h b/chrome/browser/automation/automation_resource_tracker.h index 0eade90..671f72b 100644 --- a/chrome/browser/automation/automation_resource_tracker.h +++ b/chrome/browser/automation/automation_resource_tracker.h @@ -32,10 +32,8 @@ struct AutomationResourceTraits<T*> { // of AutomationResourceTracker to live in a .cc file. class AutomationResourceTrackerImpl { public: - explicit AutomationResourceTrackerImpl(IPC::Message::Sender* sender) - : sender_(sender) {} - - virtual ~AutomationResourceTrackerImpl() {} + explicit AutomationResourceTrackerImpl(IPC::Message::Sender* sender); + virtual ~AutomationResourceTrackerImpl(); // These need to be implemented in AutomationResourceTracker, // since it needs to call the subclass's type-specific notification diff --git a/chrome/browser/automation/automation_tab_tracker.cc b/chrome/browser/automation/automation_tab_tracker.cc new file mode 100644 index 0000000..e672e2e --- /dev/null +++ b/chrome/browser/automation/automation_tab_tracker.cc @@ -0,0 +1,76 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/automation/automation_tab_tracker.h" + +#include "chrome/browser/tab_contents/navigation_controller.h" +#include "chrome/common/notification_type.h" +#include "chrome/common/notification_source.h" + +AutomationTabTracker::AutomationTabTracker(IPC::Message::Sender* automation) + : AutomationResourceTracker<NavigationController*>(automation) { +} + +AutomationTabTracker::~AutomationTabTracker() { +} + +void AutomationTabTracker::AddObserver(NavigationController* resource) { + // This tab could either be a regular tab or an external tab + // Register for both notifications. + registrar_.Add(this, NotificationType::TAB_CLOSING, + Source<NavigationController>(resource)); + registrar_.Add(this, NotificationType::EXTERNAL_TAB_CLOSED, + Source<NavigationController>(resource)); + // We also want to know about navigations so we can keep track of the last + // navigation time. + registrar_.Add(this, NotificationType::LOAD_STOP, + Source<NavigationController>(resource)); +} + +void AutomationTabTracker::RemoveObserver(NavigationController* resource) { + registrar_.Remove(this, NotificationType::TAB_CLOSING, + Source<NavigationController>(resource)); + registrar_.Remove(this, NotificationType::EXTERNAL_TAB_CLOSED, + Source<NavigationController>(resource)); + registrar_.Remove(this, NotificationType::LOAD_STOP, + Source<NavigationController>(resource)); +} + +void AutomationTabTracker::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + switch (type.value) { + case NotificationType::LOAD_STOP: + last_navigation_times_[Source<NavigationController>(source).ptr()] = + base::Time::Now(); + return; + case NotificationType::EXTERNAL_TAB_CLOSED: + case NotificationType::TAB_CLOSING: + { + std::map<NavigationController*, base::Time>::iterator iter = + last_navigation_times_.find( + Source<NavigationController>(source).ptr()); + if (iter != last_navigation_times_.end()) + last_navigation_times_.erase(iter); + } + break; + default: + NOTREACHED(); + } + AutomationResourceTracker<NavigationController*>::Observe(type, source, + details); +} + +base::Time AutomationTabTracker::GetLastNavigationTime(int handle) { + if (ContainsHandle(handle)) { + NavigationController* controller = GetResource(handle); + if (controller) { + std::map<NavigationController*, base::Time>::const_iterator iter = + last_navigation_times_.find(controller); + if (iter != last_navigation_times_.end()) + return iter->second; + } + } + return base::Time(); +} diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h index a259aed..e894f0d 100644 --- a/chrome/browser/automation/automation_tab_tracker.h +++ b/chrome/browser/automation/automation_tab_tracker.h @@ -10,78 +10,24 @@ #include "base/time.h" #include "chrome/browser/automation/automation_resource_tracker.h" -#include "chrome/browser/tab_contents/navigation_controller.h" -#include "chrome/common/notification_registrar.h" -#include "chrome/common/notification_type.h" + +class NavigationController; +class NotificationType; class AutomationTabTracker : public AutomationResourceTracker<NavigationController*> { public: - explicit AutomationTabTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker<NavigationController*>(automation) {} - - virtual ~AutomationTabTracker() { - } - - virtual void AddObserver(NavigationController* resource) { - // This tab could either be a regular tab or an external tab - // Register for both notifications. - registrar_.Add(this, NotificationType::TAB_CLOSING, - Source<NavigationController>(resource)); - registrar_.Add(this, NotificationType::EXTERNAL_TAB_CLOSED, - Source<NavigationController>(resource)); - // We also want to know about navigations so we can keep track of the last - // navigation time. - registrar_.Add(this, NotificationType::LOAD_STOP, - Source<NavigationController>(resource)); - } + explicit AutomationTabTracker(IPC::Message::Sender* automation); + virtual ~AutomationTabTracker(); - virtual void RemoveObserver(NavigationController* resource) { - registrar_.Remove(this, NotificationType::TAB_CLOSING, - Source<NavigationController>(resource)); - registrar_.Remove(this, NotificationType::EXTERNAL_TAB_CLOSED, - Source<NavigationController>(resource)); - registrar_.Remove(this, NotificationType::LOAD_STOP, - Source<NavigationController>(resource)); - } + virtual void AddObserver(NavigationController* resource); + virtual void RemoveObserver(NavigationController* resource); virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) { - switch (type.value) { - case NotificationType::LOAD_STOP: - last_navigation_times_[Source<NavigationController>(source).ptr()] = - base::Time::Now(); - return; - case NotificationType::EXTERNAL_TAB_CLOSED: - case NotificationType::TAB_CLOSING: - { - std::map<NavigationController*, base::Time>::iterator iter = - last_navigation_times_.find( - Source<NavigationController>(source).ptr()); - if (iter != last_navigation_times_.end()) - last_navigation_times_.erase(iter); - } - break; - default: - NOTREACHED(); - } - AutomationResourceTracker<NavigationController*>::Observe(type, source, - details); - } + const NotificationDetails& details); - base::Time GetLastNavigationTime(int handle) { - if (ContainsHandle(handle)) { - NavigationController* controller = GetResource(handle); - if (controller) { - std::map<NavigationController*, base::Time>::const_iterator iter = - last_navigation_times_.find(controller); - if (iter != last_navigation_times_.end()) - return iter->second; - } - } - return base::Time(); - } + base::Time GetLastNavigationTime(int handle); private: // Last time a navigation occurred. diff --git a/chrome/browser/automation/automation_window_tracker.cc b/chrome/browser/automation/automation_window_tracker.cc new file mode 100644 index 0000000..e0f8b32 --- /dev/null +++ b/chrome/browser/automation/automation_window_tracker.cc @@ -0,0 +1,25 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/automation/automation_window_tracker.h" + +#include "chrome/common/native_window_notification_source.h" + +AutomationWindowTracker::AutomationWindowTracker( + IPC::Message::Sender* automation) + : AutomationResourceTracker<gfx::NativeWindow>(automation) { +} + +AutomationWindowTracker::~AutomationWindowTracker() { +} + +void AutomationWindowTracker::AddObserver(gfx::NativeWindow resource) { + registrar_.Add(this, NotificationType::WINDOW_CLOSED, + Source<gfx::NativeWindow>(resource)); +} + +void AutomationWindowTracker::RemoveObserver(gfx::NativeWindow resource) { + registrar_.Remove(this, NotificationType::WINDOW_CLOSED, + Source<gfx::NativeWindow>(resource)); +} diff --git a/chrome/browser/automation/automation_window_tracker.h b/chrome/browser/automation/automation_window_tracker.h index e73b169..7483f1d 100644 --- a/chrome/browser/automation/automation_window_tracker.h +++ b/chrome/browser/automation/automation_window_tracker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,26 +8,16 @@ #include "build/build_config.h" #include "chrome/browser/automation/automation_resource_tracker.h" -#include "chrome/common/native_window_notification_source.h" #include "gfx/native_widget_types.h" class AutomationWindowTracker : public AutomationResourceTracker<gfx::NativeWindow> { public: - explicit AutomationWindowTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker<gfx::NativeWindow>(automation) { } - virtual ~AutomationWindowTracker() { - } + explicit AutomationWindowTracker(IPC::Message::Sender* automation); + virtual ~AutomationWindowTracker(); - virtual void AddObserver(gfx::NativeWindow resource) { - registrar_.Add(this, NotificationType::WINDOW_CLOSED, - Source<gfx::NativeWindow>(resource)); - } - - virtual void RemoveObserver(gfx::NativeWindow resource) { - registrar_.Remove(this, NotificationType::WINDOW_CLOSED, - Source<gfx::NativeWindow>(resource)); - } + virtual void AddObserver(gfx::NativeWindow resource); + virtual void RemoveObserver(gfx::NativeWindow resource); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H_ diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 6a9a90a..cecdeb7 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -46,8 +46,10 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/search_engines/template_url.h" +#include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/interstitial_page.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/translate/translate_infobar_delegate.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 870e4ff..8099884 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -10,9 +10,10 @@ #include "chrome/browser/automation/automation_provider.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/history/history.h" -#include "chrome/browser/search_engines/template_url_model.h" #include "chrome/common/notification_registrar.h" +class TemplateURLModel; + // This is an automation provider containing testing calls. class TestingAutomationProvider : public AutomationProvider, public BrowserList::Observer, diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index cc4b403..8e96e7a 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -15,6 +15,7 @@ #include "net/base/cookie_monster.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" +#include "net/http/http_response_headers.h" #include "net/http/http_request_headers.h" #include "net/http/http_util.h" #include "net/url_request/url_request_context.h" diff --git a/chrome/browser/automation/url_request_automation_job.h b/chrome/browser/automation/url_request_automation_job.h index 2a76c8e..5ce9553 100644 --- a/chrome/browser/automation/url_request_automation_job.h +++ b/chrome/browser/automation/url_request_automation_job.h @@ -7,18 +7,21 @@ #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_AUTOMATION_JOB_H_ #pragma once -#include "chrome/browser/automation/automation_resource_message_filter.h" #include "chrome/common/ref_counted_util.h" -#include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" class AutomationResourceMessageFilter; +namespace net { +class HttpResponseHeaders; +class HttpResponseInfo; +} + namespace IPC { class Message; struct AutomationURLResponse; -}; +} // URLRequestJob implementation that loads the resources using // automation. |