summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/accessibility/accessibility_extension_api.cc9
-rw-r--r--chrome/browser/accessibility/accessibility_extension_api.h12
-rw-r--r--chrome/browser/chromeos/extensions/echo_private_api.cc5
-rw-r--r--chrome/browser/chromeos/extensions/echo_private_api.h17
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc2
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.h4
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_base.cc2
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_base.h4
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc17
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc43
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_drive.h2
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc28
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc14
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_misc.h11
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc15
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc8
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_strings.h5
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc18
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h3
-rw-r--r--chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc6
-rw-r--r--chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h8
-rw-r--r--chrome/browser/extensions/api/alarms/alarms_api.cc24
-rw-r--r--chrome/browser/extensions/api/alarms/alarms_api.h12
-rw-r--r--chrome/browser/extensions/api/api_function.h4
-rw-r--r--chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc2
-rw-r--r--chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h5
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_api.cc15
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_api.h4
-rw-r--r--chrome/browser/extensions/api/audio/audio_api.cc6
-rw-r--r--chrome/browser/extensions/api/audio/audio_api.h8
-rw-r--r--chrome/browser/extensions/api/autotest_private/autotest_private_api.cc10
-rw-r--r--chrome/browser/extensions/api/autotest_private/autotest_private_api.h14
-rw-r--r--chrome/browser/extensions/api/bluetooth/bluetooth_api.cc49
-rw-r--r--chrome/browser/extensions/api/bluetooth/bluetooth_api.h6
-rw-r--r--chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc4
-rw-r--r--chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h4
-rw-r--r--chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc24
-rw-r--r--chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h2
-rw-r--r--chrome/browser/extensions/api/bookmarks/bookmarks_api.cc36
-rw-r--r--chrome/browser/extensions/api/bookmarks/bookmarks_api.h4
-rw-r--r--chrome/browser/extensions/api/browsing_data/browsing_data_api.cc19
-rw-r--r--chrome/browser/extensions/api/browsing_data/browsing_data_api.h9
-rw-r--r--chrome/browser/extensions/api/cast_channel/cast_channel_api.cc4
-rw-r--r--chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc12
-rw-r--r--chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h14
-rw-r--r--chrome/browser/extensions/api/commands/commands.cc2
-rw-r--r--chrome/browser/extensions/api/commands/commands.h4
-rw-r--r--chrome/browser/extensions/api/content_settings/content_settings_api.cc35
-rw-r--r--chrome/browser/extensions/api/content_settings/content_settings_api.h12
-rw-r--r--chrome/browser/extensions/api/context_menus/context_menus_api.cc19
-rw-r--r--chrome/browser/extensions/api/context_menus/context_menus_api.h10
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.cc8
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.h4
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_api.cc24
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_api.h4
-rw-r--r--chrome/browser/extensions/api/declarative/declarative_api.cc2
-rw-r--r--chrome/browser/extensions/api/declarative/declarative_api.h4
-rw-r--r--chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc10
-rw-r--r--chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h7
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc75
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.h35
-rw-r--r--chrome/browser/extensions/api/dial/dial_api.cc4
-rw-r--r--chrome/browser/extensions/api/discovery/discovery_api.cc6
-rw-r--r--chrome/browser/extensions/api/discovery/discovery_api.h9
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.cc61
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.h30
-rw-r--r--chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc4
-rw-r--r--chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h4
-rw-r--r--chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc6
-rw-r--r--chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h4
-rw-r--r--chrome/browser/extensions/api/execute_code_function.h4
-rw-r--r--chrome/browser/extensions/api/extension_action/extension_action_api.cc36
-rw-r--r--chrome/browser/extensions/api/extension_action/extension_action_api.h8
-rw-r--r--chrome/browser/extensions/api/feedback_private/feedback_private_api.cc27
-rw-r--r--chrome/browser/extensions/api/feedback_private/feedback_private_api.h11
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.cc31
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.h12
-rw-r--r--chrome/browser/extensions/api/font_settings/font_settings_api.cc44
-rw-r--r--chrome/browser/extensions/api/font_settings/font_settings_api.h16
-rw-r--r--chrome/browser/extensions/api/history/history_api.cc42
-rw-r--r--chrome/browser/extensions/api/history/history_api.h4
-rw-r--r--chrome/browser/extensions/api/i18n/i18n_api.cc2
-rw-r--r--chrome/browser/extensions/api/i18n/i18n_api.h4
-rw-r--r--chrome/browser/extensions/api/identity/experimental_identity_api.cc38
-rw-r--r--chrome/browser/extensions/api/identity/experimental_identity_api.h6
-rw-r--r--chrome/browser/extensions/api/identity/experimental_identity_apitest.cc3
-rw-r--r--chrome/browser/extensions/api/identity/identity_api.cc79
-rw-r--r--chrome/browser/extensions/api/identity/identity_api.h9
-rw-r--r--chrome/browser/extensions/api/identity/identity_apitest.cc3
-rw-r--r--chrome/browser/extensions/api/idle/idle_api.cc9
-rw-r--r--chrome/browser/extensions/api/idle/idle_api.h6
-rw-r--r--chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc13
-rw-r--r--chrome/browser/extensions/api/image_writer_private/image_writer_private_api.h15
-rw-r--r--chrome/browser/extensions/api/location/location_api.cc14
-rw-r--r--chrome/browser/extensions/api/location/location_api.h6
-rw-r--r--chrome/browser/extensions/api/management/management_api.cc25
-rw-r--r--chrome/browser/extensions/api/management/management_api.h8
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.cc9
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.h4
-rw-r--r--chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc65
-rw-r--r--chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h12
-rw-r--r--chrome/browser/extensions/api/module/module.cc10
-rw-r--r--chrome/browser/extensions/api/module/module.h9
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_api.h36
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc4
-rw-r--r--chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc28
-rw-r--r--chrome/browser/extensions/api/notifications/notifications_api.cc16
-rw-r--r--chrome/browser/extensions/api/omnibox/omnibox_api.cc9
-rw-r--r--chrome/browser/extensions/api/omnibox/omnibox_api.h6
-rw-r--r--chrome/browser/extensions/api/page_capture/page_capture_api.cc10
-rw-r--r--chrome/browser/extensions/api/page_capture/page_capture_api.h4
-rw-r--r--chrome/browser/extensions/api/permissions/permissions_api.cc39
-rw-r--r--chrome/browser/extensions/api/permissions/permissions_api.h10
-rw-r--r--chrome/browser/extensions/api/preference/chrome_direct_setting.cc14
-rw-r--r--chrome/browser/extensions/api/preference/chrome_direct_setting.h4
-rw-r--r--chrome/browser/extensions/api/preference/preference_api.cc32
-rw-r--r--chrome/browser/extensions/api/preference/preference_api.h4
-rw-r--r--chrome/browser/extensions/api/principals_private/principals_private_api.h4
-rw-r--r--chrome/browser/extensions/api/processes/processes_api.cc39
-rw-r--r--chrome/browser/extensions/api/processes/processes_api.h8
-rw-r--r--chrome/browser/extensions/api/push_messaging/push_messaging_api.cc22
-rw-r--r--chrome/browser/extensions/api/push_messaging/push_messaging_api.h4
-rw-r--r--chrome/browser/extensions/api/runtime/runtime_api.cc23
-rw-r--r--chrome/browser/extensions/api/runtime/runtime_api.h17
-rw-r--r--chrome/browser/extensions/api/serial/serial_api.cc2
-rw-r--r--chrome/browser/extensions/api/sessions/sessions_api.cc26
-rw-r--r--chrome/browser/extensions/api/sessions/sessions_api.h8
-rw-r--r--chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc8
-rw-r--r--chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h4
-rw-r--r--chrome/browser/extensions/api/socket/socket_api.cc2
-rw-r--r--chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.cc4
-rw-r--r--chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api.cc4
-rw-r--r--chrome/browser/extensions/api/sockets_udp/sockets_udp_api.cc2
-rw-r--r--chrome/browser/extensions/api/storage/storage_api.cc2
-rw-r--r--chrome/browser/extensions/api/storage/storage_api.h4
-rw-r--r--chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc55
-rw-r--r--chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h20
-rw-r--r--chrome/browser/extensions/api/system_private/system_private_api.cc2
-rw-r--r--chrome/browser/extensions/api/system_private/system_private_api.h7
-rw-r--r--chrome/browser/extensions/api/tab_capture/tab_capture_api.cc9
-rw-r--r--chrome/browser/extensions/api/tab_capture/tab_capture_api.h6
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_api.cc156
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_api.h46
-rw-r--r--chrome/browser/extensions/api/tabs/windows_util.cc4
-rw-r--r--chrome/browser/extensions/api/tabs/windows_util.h4
-rw-r--r--chrome/browser/extensions/api/terminal/terminal_private_api.cc5
-rw-r--r--chrome/browser/extensions/api/terminal/terminal_private_api.h4
-rw-r--r--chrome/browser/extensions/api/test/test_api.cc6
-rw-r--r--chrome/browser/extensions/api/test/test_api.h8
-rw-r--r--chrome/browser/extensions/api/top_sites/top_sites_api.cc2
-rw-r--r--chrome/browser/extensions/api/top_sites/top_sites_api.h4
-rw-r--r--chrome/browser/extensions/api/usb/usb_api.cc2
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.cc10
-rw-r--r--chrome/browser/extensions/api/web_navigation/web_navigation_api.h6
-rw-r--r--chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc4
-rw-r--r--chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h9
-rw-r--r--chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc4
-rw-r--r--chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h4
-rw-r--r--chrome/browser/extensions/api/webstore_private/webstore_private_api.cc50
-rw-r--r--chrome/browser/extensions/api/webstore_private/webstore_private_api.h30
-rw-r--r--chrome/browser/extensions/chrome_extension_function.cc114
-rw-r--r--chrome/browser/extensions/chrome_extension_function.h77
-rw-r--r--chrome/browser/extensions/extension_function.cc96
-rw-r--r--chrome/browser/extensions/extension_function.h51
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc2
-rw-r--r--chrome/browser/extensions/extension_function_test_utils.cc3
-rw-r--r--chrome/browser/extensions/window_controller_list.cc6
-rw-r--r--chrome/browser/extensions/window_controller_list.h6
-rw-r--r--chrome/browser/infobars/infobar_extension_api.cc15
-rw-r--r--chrome/browser/infobars/infobar_extension_api.h4
-rw-r--r--chrome/browser/speech/extension_api/tts_extension_api.cc4
-rw-r--r--chrome/browser/speech/extension_api/tts_extension_api.h15
-rw-r--r--chrome/chrome_browser_extensions.gypi2
173 files changed, 1491 insertions, 1251 deletions
diff --git a/chrome/browser/accessibility/accessibility_extension_api.cc b/chrome/browser/accessibility/accessibility_extension_api.cc
index 9726a5d..5efdaec 100644
--- a/chrome/browser/accessibility/accessibility_extension_api.cc
+++ b/chrome/browser/accessibility/accessibility_extension_api.cc
@@ -221,8 +221,13 @@ bool AccessibilityGetAlertsForTabFunction::RunImpl() {
TabStripModel* tab_strip = NULL;
content::WebContents* contents = NULL;
int tab_index = -1;
- if (!ExtensionTabUtil::GetTabById(tab_id, profile(), include_incognito(),
- NULL, &tab_strip, &contents, &tab_index)) {
+ if (!ExtensionTabUtil::GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ &tab_strip,
+ &contents,
+ &tab_index)) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::tabs_constants::kTabNotFoundError,
base::IntToString(tab_id));
diff --git a/chrome/browser/accessibility/accessibility_extension_api.h b/chrome/browser/accessibility/accessibility_extension_api.h
index 61c3930..cf7508d 100644
--- a/chrome/browser/accessibility/accessibility_extension_api.h
+++ b/chrome/browser/accessibility/accessibility_extension_api.h
@@ -11,7 +11,7 @@
#include "base/memory/singleton.h"
#include "base/values.h"
#include "chrome/browser/accessibility/accessibility_events.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "ui/base/accessibility/accessibility_types.h"
// Observes the profile and routes accessibility notifications as events
@@ -85,7 +85,7 @@ class ExtensionAccessibilityEventRouter {
// listeners are only installed when accessibility support is enabled, to
// minimize the impact.
class AccessibilitySetAccessibilityEnabledFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
virtual ~AccessibilitySetAccessibilityEnabledFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION(
@@ -95,7 +95,7 @@ class AccessibilitySetAccessibilityEnabledFunction
// API function that enables or disables web content accessibility support.
class AccessibilitySetNativeAccessibilityEnabledFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
virtual ~AccessibilitySetNativeAccessibilityEnabledFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION(
@@ -104,7 +104,8 @@ class AccessibilitySetNativeAccessibilityEnabledFunction
};
// API function that returns the most recent focused control.
-class AccessibilityGetFocusedControlFunction : public SyncExtensionFunction {
+class AccessibilityGetFocusedControlFunction
+ : public ChromeSyncExtensionFunction {
virtual ~AccessibilityGetFocusedControlFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION(
@@ -113,7 +114,8 @@ class AccessibilityGetFocusedControlFunction : public SyncExtensionFunction {
};
// API function that returns alerts being shown on the give tab.
-class AccessibilityGetAlertsForTabFunction : public SyncExtensionFunction {
+class AccessibilityGetAlertsForTabFunction
+ : public ChromeSyncExtensionFunction {
virtual ~AccessibilityGetAlertsForTabFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION(
diff --git a/chrome/browser/chromeos/extensions/echo_private_api.cc b/chrome/browser/chromeos/extensions/echo_private_api.cc
index 74c183c..2e0ad8a 100644
--- a/chrome/browser/chromeos/extensions/echo_private_api.cc
+++ b/chrome/browser/chromeos/extensions/echo_private_api.cc
@@ -213,9 +213,8 @@ void EchoPrivateGetUserConsentFunction::OnCancel() {
}
void EchoPrivateGetUserConsentFunction::OnMoreInfoLinkClicked() {
- chrome::NavigateParams params(profile(),
- GURL(kMoreInfoLink),
- content::PAGE_TRANSITION_LINK);
+ chrome::NavigateParams params(
+ GetProfile(), GURL(kMoreInfoLink), content::PAGE_TRANSITION_LINK);
// Open the link in a new window. The echo dialog is modal, so the current
// window is useless until the dialog is closed.
params.disposition = NEW_WINDOW;
diff --git a/chrome/browser/chromeos/extensions/echo_private_api.h b/chrome/browser/chromeos/extensions/echo_private_api.h
index 78f8d6c..b22f586 100644
--- a/chrome/browser/chromeos/extensions/echo_private_api.h
+++ b/chrome/browser/chromeos/extensions/echo_private_api.h
@@ -7,7 +7,7 @@
#include "base/compiler_specific.h"
#include "chrome/browser/chromeos/ui/echo_dialog_listener.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
class PrefRegistrySimple;
@@ -24,7 +24,8 @@ void RegisterPrefs(PrefRegistrySimple* registry);
} // namespace chromeos
-class EchoPrivateGetRegistrationCodeFunction : public SyncExtensionFunction {
+class EchoPrivateGetRegistrationCodeFunction
+ : public ChromeSyncExtensionFunction {
public:
EchoPrivateGetRegistrationCodeFunction();
@@ -38,7 +39,8 @@ class EchoPrivateGetRegistrationCodeFunction : public SyncExtensionFunction {
ECHOPRIVATE_GETREGISTRATIONCODE)
};
-class EchoPrivateGetOobeTimestampFunction : public AsyncExtensionFunction {
+class EchoPrivateGetOobeTimestampFunction
+ : public ChromeAsyncExtensionFunction {
public:
EchoPrivateGetOobeTimestampFunction();
@@ -52,7 +54,7 @@ class EchoPrivateGetOobeTimestampFunction : public AsyncExtensionFunction {
ECHOPRIVATE_GETOOBETIMESTAMP)
};
-class EchoPrivateSetOfferInfoFunction : public SyncExtensionFunction {
+class EchoPrivateSetOfferInfoFunction : public ChromeSyncExtensionFunction {
public:
EchoPrivateSetOfferInfoFunction();
@@ -65,7 +67,7 @@ class EchoPrivateSetOfferInfoFunction : public SyncExtensionFunction {
ECHOPRIVATE_SETOFFERINFO)
};
-class EchoPrivateGetOfferInfoFunction : public SyncExtensionFunction {
+class EchoPrivateGetOfferInfoFunction : public ChromeSyncExtensionFunction {
public:
EchoPrivateGetOfferInfoFunction();
@@ -83,9 +85,8 @@ class EchoPrivateGetOfferInfoFunction : public SyncExtensionFunction {
// either asks user's consent to verify the device's eligibility for the offer,
// or informs the user that the offers redeeming is disabled.
// It returns whether the user consent was given.
-class EchoPrivateGetUserConsentFunction
- : public AsyncExtensionFunction,
- public chromeos::EchoDialogListener {
+class EchoPrivateGetUserConsentFunction : public ChromeAsyncExtensionFunction,
+ public chromeos::EchoDialogListener {
public:
// Type for the dialog shown callback used in tests.
typedef base::Callback<void(chromeos::EchoDialogView* dialog)>
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
index 3c1d392..f83b1e9 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
@@ -332,7 +332,7 @@ void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected(
void FileBrowserHandlerInternalSelectFileFunction::GrantPermissions() {
fileapi::ExternalFileSystemBackend* external_backend =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile_, render_view_host())->external_backend();
+ GetProfile(), render_view_host())->external_backend();
DCHECK(external_backend);
external_backend->GetVirtualPath(full_path_, &virtual_path_);
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.h b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.h
index eb1588b..6c67de0 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.h
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.h
@@ -16,7 +16,7 @@
#include <vector>
#include "base/files/file_path.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
class Browser;
class FileBrowserHandlerInternalSelectFileFunction;
@@ -76,7 +76,7 @@ class FileSelectorFactory {
// The fileBrowserHandlerInternal.selectFile extension function implementation.
// See the file description for more info.
class FileBrowserHandlerInternalSelectFileFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
// Default constructor used in production code.
// It will create its own FileSelectorFactory implementation, and set the
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_base.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_base.cc
index 1ed47c8..808985d 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_base.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_base.cc
@@ -40,7 +40,7 @@ void LoggedAsyncExtensionFunction::SendResponse(bool success) {
base::Int64ToString(elapsed).c_str());
}
- AsyncExtensionFunction::SendResponse(success);
+ ChromeAsyncExtensionFunction::SendResponse(success);
}
} // namespace extensions
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_base.h b/chrome/browser/chromeos/extensions/file_manager/private_api_base.h
index 308713b..621e121 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_base.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_base.h
@@ -8,7 +8,7 @@
#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_BASE_H_
#include "base/time/time.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
@@ -20,7 +20,7 @@ namespace extensions {
// set_log_on_completion(true) to enable it, if they want. However, even if
// the logging is turned off, a warning is emitted when a function call is
// very slow. See the implementation of SendResponse() for details.
-class LoggedAsyncExtensionFunction : public AsyncExtensionFunction {
+class LoggedAsyncExtensionFunction : public ChromeAsyncExtensionFunction {
public:
LoggedAsyncExtensionFunction();
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc
index 07a36ab..b938273 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_dialog.cc
@@ -39,13 +39,13 @@ bool FileBrowserPrivateSelectFileFunction::RunImpl() {
file_manager::util::GetSelectedFileInfo(
render_view_host(),
- profile(),
+ GetProfile(),
file_paths,
option,
- base::Bind(&FileBrowserPrivateSelectFileFunction::
- GetSelectedFileInfoResponse,
- this,
- params->index));
+ base::Bind(
+ &FileBrowserPrivateSelectFileFunction::GetSelectedFileInfoResponse,
+ this,
+ params->index));
return true;
}
@@ -76,13 +76,14 @@ bool FileBrowserPrivateSelectFilesFunction::RunImpl() {
file_manager::util::GetSelectedFileInfo(
render_view_host(),
- profile(),
+ GetProfile(),
file_urls,
params->should_return_local_path ?
file_manager::util::NEED_LOCAL_PATH_FOR_OPENING :
file_manager::util::NO_LOCAL_PATH_RESOLUTION,
- base::Bind(&FileBrowserPrivateSelectFilesFunction::
- GetSelectedFileInfoResponse, this));
+ base::Bind(
+ &FileBrowserPrivateSelectFilesFunction::GetSelectedFileInfoResponse,
+ this));
return true;
}
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
index 342b815..6439a41 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -96,16 +96,16 @@ bool FileBrowserPrivateGetDriveEntryPropertiesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
const GURL file_url = GURL(params->file_url);
- file_path_ = drive::util::ExtractDrivePath(
- file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), file_url));
+ file_path_ =
+ drive::util::ExtractDrivePath(file_manager::util::GetLocalPathFromURL(
+ render_view_host(), GetProfile(), file_url));
properties_.reset(new extensions::api::file_browser_private::
DriveEntryProperties);
// Start getting the file info.
drive::FileSystemInterface* file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) {
// |file_system| is NULL if Drive is disabled or not mounted.
CompleteGetFileProperties(drive::FILE_ERROR_FAILED);
@@ -133,9 +133,9 @@ void FileBrowserPrivateGetDriveEntryPropertiesFunction::OnGetFileInfo(
FillDriveEntryPropertiesValue(*entry, properties_.get());
drive::FileSystemInterface* file_system =
- drive::util::GetFileSystemByProfile(profile_);
+ drive::util::GetFileSystemByProfile(GetProfile());
drive::DriveAppRegistry* app_registry =
- drive::util::GetDriveAppRegistryByProfile(profile_);
+ drive::util::GetDriveAppRegistryByProfile(GetProfile());
if (!file_system || !app_registry) {
// |file_system| or |app_registry| is NULL if Drive is disabled.
CompleteGetFileProperties(drive::FILE_ERROR_FAILED);
@@ -161,7 +161,7 @@ void FileBrowserPrivateGetDriveEntryPropertiesFunction::OnGetFileInfo(
if (!drive_apps.empty()) {
std::string default_task_id =
file_manager::file_tasks::GetDefaultTaskIdFromPrefs(
- *profile_->GetPrefs(),
+ *GetProfile()->GetPrefs(),
file_specific_info.content_mime_type(),
file_path_.Extension());
file_manager::file_tasks::TaskDescriptor default_task;
@@ -211,13 +211,13 @@ bool FileBrowserPrivatePinDriveFileFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
drive::FileSystemInterface* const file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) // |file_system| is NULL if Drive is disabled.
return false;
const base::FilePath drive_path =
drive::util::ExtractDrivePath(file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->file_url)));
+ render_view_host(), GetProfile(), GURL(params->file_url)));
if (params->pin) {
file_system->Pin(drive_path,
base::Bind(&FileBrowserPrivatePinDriveFileFunction::
@@ -258,7 +258,7 @@ bool FileBrowserPrivateGetDriveFilesFunction::RunImpl() {
// Convert the list of strings to a list of GURLs.
for (size_t i = 0; i < params->file_urls.size(); ++i) {
const base::FilePath path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->file_urls[i]));
+ render_view_host(), GetProfile(), GURL(params->file_urls[i]));
DCHECK(drive::util::IsUnderDriveMountPoint(path));
base::FilePath drive_path = drive::util::ExtractDrivePath(path);
remaining_drive_paths_.push(drive_path);
@@ -281,7 +281,7 @@ void FileBrowserPrivateGetDriveFilesFunction::GetFileOrSendResponse() {
base::FilePath drive_path = remaining_drive_paths_.front();
drive::FileSystemInterface* file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) {
// |file_system| is NULL if Drive is disabled or not mounted.
OnFileReady(drive::FILE_ERROR_FAILED, drive_path,
@@ -328,7 +328,7 @@ bool FileBrowserPrivateCancelFileTransfersFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
drive::DriveIntegrationService* integration_service =
- drive::DriveIntegrationServiceFactory::FindForProfile(profile_);
+ drive::DriveIntegrationServiceFactory::FindForProfile(GetProfile());
if (!integration_service || !integration_service->IsMounted())
return false;
@@ -349,7 +349,7 @@ bool FileBrowserPrivateCancelFileTransfersFunction::RunImpl() {
FileTransferCancelStatus> > responses;
for (size_t i = 0; i < params->file_urls.size(); ++i) {
base::FilePath file_path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->file_urls[i]));
+ render_view_host(), GetProfile(), GURL(params->file_urls[i]));
if (file_path.empty())
continue;
@@ -382,7 +382,7 @@ bool FileBrowserPrivateSearchDriveFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
drive::FileSystemInterface* const file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) {
// |file_system| is NULL if Drive is disabled.
return false;
@@ -442,7 +442,7 @@ bool FileBrowserPrivateSearchDriveMetadataFunction::RunImpl() {
set_log_on_completion(true);
drive::FileSystemInterface* const file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) {
// |file_system| is NULL if Drive is disabled.
return false;
@@ -517,7 +517,7 @@ void FileBrowserPrivateSearchDriveMetadataFunction::OnSearchMetadata(
bool FileBrowserPrivateClearDriveCacheFunction::RunImpl() {
drive::DriveIntegrationService* integration_service =
- drive::DriveIntegrationServiceFactory::FindForProfile(profile_);
+ drive::DriveIntegrationServiceFactory::FindForProfile(GetProfile());
if (!integration_service || !integration_service->IsMounted())
return false;
@@ -532,7 +532,7 @@ bool FileBrowserPrivateClearDriveCacheFunction::RunImpl() {
bool FileBrowserPrivateGetDriveConnectionStateFunction::RunImpl() {
drive::DriveServiceInterface* const drive_service =
- drive::util::GetDriveServiceByProfile(profile());
+ drive::util::GetDriveServiceByProfile(GetProfile());
api::file_browser_private::GetDriveConnectionState::Results::Result result;
@@ -551,7 +551,8 @@ bool FileBrowserPrivateGetDriveConnectionStateFunction::RunImpl() {
result.reasons.push_back(kDriveConnectionReasonNoService);
} else if (
is_connection_cellular &&
- profile_->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular)) {
+ GetProfile()->GetPrefs()->GetBoolean(
+ prefs::kDisableDriveOverCellular)) {
result.type = kDriveConnectionTypeMetered;
} else {
result.type = kDriveConnectionTypeOnline;
@@ -570,7 +571,7 @@ bool FileBrowserPrivateRequestAccessTokenFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
drive::DriveServiceInterface* const drive_service =
- drive::util::GetDriveServiceByProfile(profile());
+ drive::util::GetDriveServiceByProfile(GetProfile());
if (!drive_service) {
// DriveService is not available.
@@ -604,13 +605,13 @@ bool FileBrowserPrivateGetShareUrlFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
const base::FilePath path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->url));
+ render_view_host(), GetProfile(), GURL(params->url));
DCHECK(drive::util::IsUnderDriveMountPoint(path));
const base::FilePath drive_path = drive::util::ExtractDrivePath(path);
drive::FileSystemInterface* const file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) {
// |file_system| is NULL if Drive is disabled.
return false;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h
index 2156e53..e119405 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h
@@ -176,7 +176,7 @@ class FileBrowserPrivateClearDriveCacheFunction
// Implements the chrome.fileBrowserPrivate.getDriveConnectionState method.
class FileBrowserPrivateGetDriveConnectionStateFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"fileBrowserPrivate.getDriveConnectionState",
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
index 4f4858a..5c30cbc 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
@@ -352,7 +352,7 @@ bool FileBrowserPrivateRequestFileSystemFunction::RunImpl() {
scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
// Set up file permission access.
const int child_id = render_view_host()->GetProcess()->GetID();
@@ -370,7 +370,8 @@ bool FileBrowserPrivateRequestFileSystemFunction::RunImpl() {
// Note that we call this function even when Drive is disabled by the
// setting. Otherwise, we need to call this when the setting is changed at
// a later time, which complicates the code.
- SetDriveMountPointPermissions(profile_, extension_id(), render_view_host());
+ SetDriveMountPointPermissions(
+ GetProfile(), extension_id(), render_view_host());
fileapi::FileSystemInfo info =
fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin());
@@ -404,7 +405,7 @@ bool FileWatchFunctionBase::RunImpl() {
scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
FileSystemURL file_watch_url = file_system_context->CrackURL(GURL(url));
base::FilePath local_path = file_watch_url.path();
@@ -425,7 +426,7 @@ void FileBrowserPrivateAddFileWatchFunction::PerformFileWatchOperation(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
file_manager::EventRouter* event_router =
- file_manager::FileBrowserPrivateAPI::Get(profile_)->event_router();
+ file_manager::FileBrowserPrivateAPI::Get(GetProfile())->event_router();
event_router->AddFileWatch(
local_path,
virtual_path,
@@ -440,7 +441,7 @@ void FileBrowserPrivateRemoveFileWatchFunction::PerformFileWatchOperation(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
file_manager::EventRouter* event_router =
- file_manager::FileBrowserPrivateAPI::Get(profile_)->event_router();
+ file_manager::FileBrowserPrivateAPI::Get(GetProfile())->event_router();
event_router->RemoveFileWatch(local_path, extension_id);
Respond(true);
}
@@ -451,13 +452,13 @@ bool FileBrowserPrivateGetSizeStatsFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
base::FilePath file_path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->mount_path));
+ render_view_host(), GetProfile(), GURL(params->mount_path));
if (file_path.empty())
return false;
if (file_path == drive::util::GetDriveMountPointPath()) {
drive::FileSystemInterface* file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system) {
// |file_system| is NULL if Drive is disabled.
// If stats couldn't be gotten for drive, result should be left
@@ -522,7 +523,7 @@ bool FileBrowserPrivateValidatePathNameLengthFunction::RunImpl() {
scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
fileapi::FileSystemURL filesystem_url(
file_system_context->CrackURL(GURL(params->parent_directory_url)));
@@ -560,7 +561,7 @@ bool FileBrowserPrivateFormatDeviceFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
base::FilePath file_path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->mount_path));
+ render_view_host(), GetProfile(), GURL(params->mount_path));
if (file_path.empty())
return false;
@@ -585,7 +586,7 @@ bool FileBrowserPrivateStartCopyFunction::RunImpl() {
scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
fileapi::FileSystemURL source_url(
file_system_context->CrackURL(GURL(params->source_url)));
@@ -602,7 +603,10 @@ bool FileBrowserPrivateStartCopyFunction::RunImpl() {
BrowserThread::IO,
FROM_HERE,
base::Bind(&StartCopyOnIOThread,
- profile(), file_system_context, source_url, destination_url),
+ GetProfile(),
+ file_system_context,
+ source_url,
+ destination_url),
base::Bind(&FileBrowserPrivateStartCopyFunction::RunAfterStartCopy,
this));
}
@@ -624,7 +628,7 @@ bool FileBrowserPrivateCancelCopyFunction::RunImpl() {
scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
// We don't much take care about the result of cancellation.
BrowserThread::PostTask(
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
index 45c50e1..141721f 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
@@ -38,9 +38,9 @@ bool FileBrowserPrivateLogoutUserFunction::RunImpl() {
bool FileBrowserPrivateGetPreferencesFunction::RunImpl() {
api::file_browser_private::GetPreferences::Results::Result result;
- const PrefService* const service = profile_->GetPrefs();
+ const PrefService* const service = GetProfile()->GetPrefs();
- result.drive_enabled = drive::util::IsDriveEnabledForProfile(profile_);
+ result.drive_enabled = drive::util::IsDriveEnabledForProfile(GetProfile());
result.cellular_disabled =
service->GetBoolean(prefs::kDisableDriveOverCellular);
result.hosted_files_disabled =
@@ -64,7 +64,7 @@ bool FileBrowserPrivateSetPreferencesFunction::RunImpl() {
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- PrefService* const service = profile_->GetPrefs();
+ PrefService* const service = GetProfile()->GetPrefs();
if (params->change_info.cellular_disabled)
service->SetBoolean(prefs::kDisableDriveOverCellular,
@@ -94,7 +94,7 @@ bool FileBrowserPrivateZipSelectionFunction::RunImpl() {
return false;
base::FilePath src_dir = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->dir_url));
+ render_view_host(), GetProfile(), GURL(params->dir_url));
if (src_dir.empty())
return false;
@@ -105,7 +105,7 @@ bool FileBrowserPrivateZipSelectionFunction::RunImpl() {
std::vector<base::FilePath> files;
for (size_t i = 0; i < params->selection_urls.size(); ++i) {
base::FilePath path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->selection_urls[i]));
+ render_view_host(), GetProfile(), GURL(params->selection_urls[i]));
if (path.empty())
return false;
files.push_back(path);
@@ -192,7 +192,7 @@ bool FileBrowserPrivateInstallWebstoreItemFunction::RunImpl() {
new file_manager::FileManagerInstaller(
GetAssociatedWebContents(), // web_contents(),
params->item_id,
- profile(),
+ GetProfile(),
callback));
// installer will be AddRef()'d in BeginInstall().
installer->BeginInstall();
@@ -230,7 +230,7 @@ bool FileBrowserPrivateRequestWebStoreAccessTokenFunction::RunImpl() {
scopes.push_back(kCWSScope);
ProfileOAuth2TokenService* oauth_service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
net::URLRequestContextGetter* url_request_context_getter =
g_browser_process->system_request_context();
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
index dda98b3..a584273 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
@@ -19,7 +19,8 @@ class AuthServiceInterface;
namespace extensions {
// Implements the chrome.fileBrowserPrivate.logoutUser method.
-class FileBrowserPrivateLogoutUserFunction : public SyncExtensionFunction {
+class FileBrowserPrivateLogoutUserFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser",
FILEBROWSERPRIVATE_LOGOUTUSER)
@@ -33,7 +34,8 @@ class FileBrowserPrivateLogoutUserFunction : public SyncExtensionFunction {
// Implements the chrome.fileBrowserPrivate.getPreferences method.
// Gets settings for Files.app.
-class FileBrowserPrivateGetPreferencesFunction : public SyncExtensionFunction {
+class FileBrowserPrivateGetPreferencesFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences",
FILEBROWSERPRIVATE_GETPREFERENCES)
@@ -46,7 +48,8 @@ class FileBrowserPrivateGetPreferencesFunction : public SyncExtensionFunction {
// Implements the chrome.fileBrowserPrivate.setPreferences method.
// Sets settings for Files.app.
-class FileBrowserPrivateSetPreferencesFunction : public SyncExtensionFunction {
+class FileBrowserPrivateSetPreferencesFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences",
FILEBROWSERPRIVATE_SETPREFERENCES)
@@ -85,7 +88,7 @@ class FileBrowserPrivateZipSelectionFunction
// Changes the zoom level of the file manager by internally calling
// RenderViewHost::Zoom(). TODO(hirono): Remove this function once the zoom
// level change is supported for all apps. crbug.com/227175.
-class FileBrowserPrivateZoomFunction : public SyncExtensionFunction {
+class FileBrowserPrivateZoomFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom",
FILEBROWSERPRIVATE_ZOOM);
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
index 5e9c094..63cb6a8 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
@@ -39,7 +39,7 @@ bool FileBrowserPrivateAddMountFunction::RunImpl() {
set_log_on_completion(true);
const base::FilePath path = file_manager::util::GetLocalPathFromURL(
- render_view_host(), profile(), GURL(params->source));
+ render_view_host(), GetProfile(), GURL(params->source));
if (path.empty())
return false;
@@ -47,7 +47,7 @@ bool FileBrowserPrivateAddMountFunction::RunImpl() {
// Check if the source path is under Drive cache directory.
if (drive::util::IsUnderDriveMountPoint(path)) {
drive::FileSystemInterface* file_system =
- drive::util::GetFileSystemByProfile(profile());
+ drive::util::GetFileSystemByProfile(GetProfile());
if (!file_system)
return false;
@@ -103,11 +103,12 @@ bool FileBrowserPrivateRemoveMountFunction::RunImpl() {
file_paths.push_back(GURL(params->mount_path));
file_manager::util::GetSelectedFileInfo(
render_view_host(),
- profile(),
+ GetProfile(),
file_paths,
file_manager::util::NEED_LOCAL_PATH_FOR_OPENING,
- base::Bind(&FileBrowserPrivateRemoveMountFunction::
- GetSelectedFileInfoResponse, this));
+ base::Bind(
+ &FileBrowserPrivateRemoveMountFunction::GetSelectedFileInfoResponse,
+ this));
return true;
}
@@ -135,7 +136,7 @@ bool FileBrowserPrivateGetVolumeMetadataListFunction::RunImpl() {
return false;
const std::vector<file_manager::VolumeInfo>& volume_info_list =
- file_manager::VolumeManager::Get(profile_)->GetVolumeInfoList();
+ file_manager::VolumeManager::Get(GetProfile())->GetVolumeInfoList();
std::string log_string;
std::vector<linked_ptr<file_browser_private::VolumeMetadata> > result;
@@ -143,7 +144,7 @@ bool FileBrowserPrivateGetVolumeMetadataListFunction::RunImpl() {
linked_ptr<file_browser_private::VolumeMetadata> volume_metadata(
new file_browser_private::VolumeMetadata);
file_manager::util::VolumeInfoToVolumeMetadata(
- profile(), volume_info_list[i], volume_metadata.get());
+ GetProfile(), volume_info_list[i], volume_metadata.get());
result.push_back(volume_metadata);
if (!log_string.empty())
log_string += ", ";
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
index 21a7759..d697ac6 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
@@ -522,11 +522,11 @@ bool FileBrowserPrivateGetStringsFunction::RunImpl() {
#undef SET_STRING
dict->SetBoolean("PDF_VIEW_ENABLED",
- file_manager::util::ShouldBeOpenedWithPlugin(profile(),
- FILE_PATH_LITERAL(".pdf")));
+ file_manager::util::ShouldBeOpenedWithPlugin(
+ GetProfile(), FILE_PATH_LITERAL(".pdf")));
dict->SetBoolean("SWF_VIEW_ENABLED",
- file_manager::util::ShouldBeOpenedWithPlugin(profile(),
- FILE_PATH_LITERAL(".swf")));
+ file_manager::util::ShouldBeOpenedWithPlugin(
+ GetProfile(), FILE_PATH_LITERAL(".swf")));
webui::SetFontAndTextDirection(dict);
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.h b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.h
index 579632f..3546050 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.h
@@ -7,13 +7,14 @@
#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_STRINGS_H_
#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_STRINGS_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
// Implements the chrome.fileBrowserPrivate.getStrings method.
// Used to get strings for the file manager from JavaScript.
-class FileBrowserPrivateGetStringsFunction : public SyncExtensionFunction {
+class FileBrowserPrivateGetStringsFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getStrings",
FILEBROWSERPRIVATE_GETSTRINGS)
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc
index ce988b9..cecd07f 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc
@@ -76,7 +76,7 @@ bool FileBrowserPrivateExecuteTaskFunction::RunImpl() {
const scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
std::vector<FileSystemURL> file_urls;
for (size_t i = 0; i < params->file_urls.size(); i++) {
@@ -91,7 +91,7 @@ bool FileBrowserPrivateExecuteTaskFunction::RunImpl() {
const int32 tab_id = file_manager::util::GetTabId(dispatcher());
return file_manager::file_tasks::ExecuteFileTask(
- profile(),
+ GetProfile(),
source_url(),
extension_->id(),
tab_id,
@@ -120,7 +120,7 @@ bool FileBrowserPrivateGetFileTasksFunction::RunImpl() {
const scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
// Collect all the URLs, convert them to GURLs, and crack all the urls into
// file paths.
@@ -149,8 +149,8 @@ bool FileBrowserPrivateGetFileTasksFunction::RunImpl() {
std::vector<file_manager::file_tasks::FullTaskDescriptor> tasks;
file_manager::file_tasks::FindAllTypesOfTasks(
- profile_,
- drive::util::GetDriveAppRegistryByProfile(profile_),
+ GetProfile(),
+ drive::util::GetDriveAppRegistryByProfile(GetProfile()),
path_mime_set,
file_urls,
&tasks);
@@ -182,7 +182,7 @@ bool FileBrowserPrivateSetDefaultTaskFunction::RunImpl() {
const scoped_refptr<fileapi::FileSystemContext> file_system_context =
file_manager::util::GetFileSystemContextForRenderViewHost(
- profile(), render_view_host());
+ GetProfile(), render_view_host());
const std::set<std::string> suffixes =
GetUniqueSuffixes(params->file_urls, file_system_context.get());
@@ -206,10 +206,8 @@ bool FileBrowserPrivateSetDefaultTaskFunction::RunImpl() {
return true;
}
- file_manager::file_tasks::UpdateDefaultTask(profile_->GetPrefs(),
- params->task_id,
- suffixes,
- mime_types);
+ file_manager::file_tasks::UpdateDefaultTask(
+ GetProfile()->GetPrefs(), params->task_id, suffixes, mime_types);
return true;
}
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h
index fd4a7bd..28898a6 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.h
@@ -53,7 +53,8 @@ class FileBrowserPrivateGetFileTasksFunction
};
// Implements the chrome.fileBrowserPrivate.setDefaultTask method.
-class FileBrowserPrivateSetDefaultTaskFunction : public SyncExtensionFunction {
+class FileBrowserPrivateSetDefaultTaskFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setDefaultTask",
FILEBROWSERPRIVATE_SETDEFAULTTASK)
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc
index 04a6406..db3603a 100644
--- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc
+++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.cc
@@ -144,7 +144,7 @@ bool ActivityLogPrivateGetExtensionActivitiesFunction::RunImpl() {
days_ago = *filter->days_ago;
// Call the ActivityLog.
- ActivityLog* activity_log = ActivityLog::GetInstance(profile_);
+ ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile());
DCHECK(activity_log);
activity_log->GetFilteredActions(
extension_id,
@@ -181,7 +181,7 @@ void ActivityLogPrivateGetExtensionActivitiesFunction::OnLookupCompleted(
}
bool ActivityLogPrivateDeleteDatabaseFunction::RunImpl() {
- ActivityLog* activity_log = ActivityLog::GetInstance(profile_);
+ ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile());
DCHECK(activity_log);
activity_log->DeleteDatabase();
return true;
@@ -201,7 +201,7 @@ bool ActivityLogPrivateDeleteUrlsFunction::RunImpl() {
gurls.push_back(GURL(*it));
}
- ActivityLog* activity_log = ActivityLog::GetInstance(profile_);
+ ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile());
DCHECK(activity_log);
activity_log->RemoveURLs(gurls);
return true;
diff --git a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h
index 45ec258e..a2bf60b 100644
--- a/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h
+++ b/chrome/browser/extensions/api/activity_log_private/activity_log_private_api.h
@@ -13,8 +13,8 @@
#include "chrome/browser/extensions/activity_log/activity_actions.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
namespace extensions {
@@ -66,7 +66,7 @@ void ProfileKeyedAPIFactory<ActivityLogAPI>::DeclareFactoryDependencies();
// The implementation of activityLogPrivate.getExtensionActivities
class ActivityLogPrivateGetExtensionActivitiesFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("activityLogPrivate.getExtensionActivities",
ACTIVITYLOGPRIVATE_GETEXTENSIONACTIVITIES)
@@ -84,7 +84,7 @@ class ActivityLogPrivateGetExtensionActivitiesFunction
// The implementation of activityLogPrivate.deleteDatabase
class ActivityLogPrivateDeleteDatabaseFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("activityLogPrivate.deleteDatabase",
ACTIVITYLOGPRIVATE_DELETEDATABASE)
@@ -98,7 +98,7 @@ class ActivityLogPrivateDeleteDatabaseFunction
// The implementation of activityLogPrivate.deleteUrls
class ActivityLogPrivateDeleteUrlsFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("activityLogPrivate.deleteUrls",
ACTIVITYLOGPRIVATE_DELETEURLS)
diff --git a/chrome/browser/extensions/api/alarms/alarms_api.cc b/chrome/browser/extensions/api/alarms/alarms_api.cc
index cc49b6e..7c06214 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api.cc
+++ b/chrome/browser/extensions/api/alarms/alarms_api.cc
@@ -120,8 +120,8 @@ bool AlarmsCreateFunction::RunImpl() {
Manifest::IsUnpackedLocation(GetExtension()->location()) ?
kDevDelayMinimum : kReleaseDelayMinimum),
clock_->Now());
- AlarmManager::Get(profile())->AddAlarm(extension_id(), alarm, base::Bind(
- &AlarmsCreateFunction::Callback, this));
+ AlarmManager::Get(GetProfile())->AddAlarm(
+ extension_id(), alarm, base::Bind(&AlarmsCreateFunction::Callback, this));
return true;
}
@@ -135,8 +135,10 @@ bool AlarmsGetFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string name = params->name.get() ? *params->name : kDefaultAlarmName;
- AlarmManager::Get(profile())->GetAlarm(extension_id(), name, base::Bind(
- &AlarmsGetFunction::Callback, this, name));
+ AlarmManager::Get(GetProfile())
+ ->GetAlarm(extension_id(),
+ name,
+ base::Bind(&AlarmsGetFunction::Callback, this, name));
return true;
}
@@ -153,8 +155,8 @@ void AlarmsGetFunction::Callback(
}
bool AlarmsGetAllFunction::RunImpl() {
- AlarmManager::Get(profile())->GetAllAlarms(extension_id(), base::Bind(
- &AlarmsGetAllFunction::Callback, this));
+ AlarmManager::Get(GetProfile())->GetAllAlarms(
+ extension_id(), base::Bind(&AlarmsGetAllFunction::Callback, this));
return true;
}
@@ -178,8 +180,10 @@ bool AlarmsClearFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string name = params->name.get() ? *params->name : kDefaultAlarmName;
- AlarmManager::Get(profile())->RemoveAlarm(extension_id(), name, base::Bind(
- &AlarmsClearFunction::Callback, this, name));
+ AlarmManager::Get(GetProfile())
+ ->RemoveAlarm(extension_id(),
+ name,
+ base::Bind(&AlarmsClearFunction::Callback, this, name));
return true;
}
@@ -192,8 +196,8 @@ void AlarmsClearFunction::Callback(const std::string& name, bool success) {
}
bool AlarmsClearAllFunction::RunImpl() {
- AlarmManager::Get(profile())->RemoveAllAlarms(extension_id(), base::Bind(
- &AlarmsClearAllFunction::Callback, this));
+ AlarmManager::Get(GetProfile())->RemoveAllAlarms(
+ extension_id(), base::Bind(&AlarmsClearAllFunction::Callback, this));
return true;
}
diff --git a/chrome/browser/extensions/api/alarms/alarms_api.h b/chrome/browser/extensions/api/alarms/alarms_api.h
index b14a166..3d971af 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api.h
+++ b/chrome/browser/extensions/api/alarms/alarms_api.h
@@ -7,7 +7,7 @@
#include <vector>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace base {
class Clock;
@@ -17,7 +17,7 @@ namespace extensions {
struct Alarm;
typedef std::vector<Alarm> AlarmList;
-class AlarmsCreateFunction : public AsyncExtensionFunction {
+class AlarmsCreateFunction : public ChromeAsyncExtensionFunction {
public:
AlarmsCreateFunction();
// Use |clock| instead of the default clock. Does not take ownership
@@ -39,7 +39,7 @@ class AlarmsCreateFunction : public AsyncExtensionFunction {
bool owns_clock_;
};
-class AlarmsGetFunction : public AsyncExtensionFunction {
+class AlarmsGetFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~AlarmsGetFunction() {}
@@ -51,7 +51,7 @@ class AlarmsGetFunction : public AsyncExtensionFunction {
DECLARE_EXTENSION_FUNCTION("alarms.get", ALARMS_GET)
};
-class AlarmsGetAllFunction : public AsyncExtensionFunction {
+class AlarmsGetAllFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~AlarmsGetAllFunction() {}
@@ -62,7 +62,7 @@ class AlarmsGetAllFunction : public AsyncExtensionFunction {
DECLARE_EXTENSION_FUNCTION("alarms.getAll", ALARMS_GETALL)
};
-class AlarmsClearFunction : public AsyncExtensionFunction {
+class AlarmsClearFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~AlarmsClearFunction() {}
@@ -73,7 +73,7 @@ class AlarmsClearFunction : public AsyncExtensionFunction {
DECLARE_EXTENSION_FUNCTION("alarms.clear", ALARMS_CLEAR)
};
-class AlarmsClearAllFunction : public AsyncExtensionFunction {
+class AlarmsClearAllFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~AlarmsClearAllFunction() {}
diff --git a/chrome/browser/extensions/api/api_function.h b/chrome/browser/extensions/api/api_function.h
index 0aacdad..5fb32a9 100644
--- a/chrome/browser/extensions/api/api_function.h
+++ b/chrome/browser/extensions/api/api_function.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_API_FUNCTION_H_
#define CHROME_BROWSER_EXTENSIONS_API_API_FUNCTION_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "content/public/browser/browser_thread.h"
namespace extensions {
@@ -13,7 +13,7 @@ namespace extensions {
// Base class for API functions. TODO(miket): there isn't much here anymore
// since the removal of ApiResourceEventRouter. Should we promote all its
// subclasses to UIThreadExtensionFunctions?
-class ApiFunction : public UIThreadExtensionFunction {
+class ApiFunction : public ChromeAsyncExtensionFunction {
protected:
ApiFunction();
virtual ~ApiFunction();
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
index 8dbd8b6..ad3b816 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
@@ -43,7 +43,7 @@ const char kDevChannelOnly[] =
bool AppCurrentWindowInternalExtensionFunction::RunImpl() {
apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(profile());
+ apps::ShellWindowRegistry::Get(GetProfile());
DCHECK(registry);
content::RenderViewHost* rvh = render_view_host();
if (!rvh)
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h
index 648724f..9581f64 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_APP_CURRENT_WINDOW_INTERNAL_APP_CURRENT_WINDOW_INTERNAL_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_APP_CURRENT_WINDOW_INTERNAL_APP_CURRENT_WINDOW_INTERNAL_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace apps {
class ShellWindow;
@@ -13,7 +13,8 @@ class ShellWindow;
namespace extensions {
-class AppCurrentWindowInternalExtensionFunction : public SyncExtensionFunction {
+class AppCurrentWindowInternalExtensionFunction
+ : public ChromeSyncExtensionFunction {
protected:
virtual ~AppCurrentWindowInternalExtensionFunction() {}
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index d4cf282..92fe656 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -145,9 +145,9 @@ bool AppWindowCreateFunction::RunImpl() {
create_params.window_key = *options->id;
if (!options->singleton || *options->singleton) {
- ShellWindow* window = apps::ShellWindowRegistry::Get(profile())->
- GetShellWindowForAppAndKey(extension_id(),
- create_params.window_key);
+ ShellWindow* window = apps::ShellWindowRegistry::Get(
+ GetProfile())->GetShellWindowForAppAndKey(extension_id(),
+ create_params.window_key);
if (window) {
content::RenderViewHost* created_view =
window->web_contents()->GetRenderViewHost();
@@ -273,9 +273,8 @@ bool AppWindowCreateFunction::RunImpl() {
create_params.creator_process_id =
render_view_host_->GetProcess()->GetID();
- ShellWindow* shell_window = new ShellWindow(profile(),
- new ChromeShellWindowDelegate(),
- GetExtension());
+ ShellWindow* shell_window = new ShellWindow(
+ GetProfile(), new ChromeShellWindowDelegate(), GetExtension());
shell_window->Init(url,
new apps::AppWindowContents(shell_window),
create_params);
@@ -297,8 +296,8 @@ bool AppWindowCreateFunction::RunImpl() {
SetCreateResultFromShellWindow(shell_window, result);
SetResult(result);
- if (apps::ShellWindowRegistry::Get(profile())->
- HadDevToolsAttached(created_view)) {
+ if (apps::ShellWindowRegistry::Get(GetProfile())
+ ->HadDevToolsAttached(created_view)) {
new DevToolsRestorer(this, created_view);
return true;
}
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.h b/chrome/browser/extensions/api/app_window/app_window_api.h
index 72524d6..8aaac544 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.h
+++ b/chrome/browser/extensions/api/app_window/app_window_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_APP_WINDOW_APP_WINDOW_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_APP_WINDOW_APP_WINDOW_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
-class AppWindowCreateFunction : public AsyncExtensionFunction {
+class AppWindowCreateFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("app.window.create", APP_WINDOW_CREATE)
diff --git a/chrome/browser/extensions/api/audio/audio_api.cc b/chrome/browser/extensions/api/audio/audio_api.cc
index 359b48d..90415ae 100644
--- a/chrome/browser/extensions/api/audio/audio_api.cc
+++ b/chrome/browser/extensions/api/audio/audio_api.cc
@@ -50,7 +50,7 @@ void AudioAPI::OnDeviceChanged() {
bool AudioGetInfoFunction::RunImpl() {
AudioService* service =
- AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService();
+ AudioAPI::GetFactoryInstance()->GetForProfile(GetProfile())->GetService();
DCHECK(service);
service->StartGetInfo(base::Bind(&AudioGetInfoFunction::OnGetInfoCompleted,
this));
@@ -73,7 +73,7 @@ bool AudioSetActiveDevicesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
AudioService* service =
- AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService();
+ AudioAPI::GetFactoryInstance()->GetForProfile(GetProfile())->GetService();
DCHECK(service);
service->SetActiveDevices(params->ids);
@@ -86,7 +86,7 @@ bool AudioSetPropertiesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
AudioService* service =
- AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService();
+ AudioAPI::GetFactoryInstance()->GetForProfile(GetProfile())->GetService();
DCHECK(service);
int volume_value = params->properties.volume.get() ?
diff --git a/chrome/browser/extensions/api/audio/audio_api.h b/chrome/browser/extensions/api/audio/audio_api.h
index ae9398a..e5a63ee 100644
--- a/chrome/browser/extensions/api/audio/audio_api.h
+++ b/chrome/browser/extensions/api/audio/audio_api.h
@@ -7,7 +7,7 @@
#include "chrome/browser/extensions/api/audio/audio_service.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
@@ -39,7 +39,7 @@ class AudioAPI : public ProfileKeyedAPI,
AudioService* service_;
};
-class AudioGetInfoFunction : public AsyncExtensionFunction {
+class AudioGetInfoFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("audio.getInfo",
AUDIO_GETINFO);
@@ -54,7 +54,7 @@ class AudioGetInfoFunction : public AsyncExtensionFunction {
bool success);
};
-class AudioSetActiveDevicesFunction : public SyncExtensionFunction {
+class AudioSetActiveDevicesFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("audio.setActiveDevices",
AUDIO_SETACTIVEDEVICES);
@@ -64,7 +64,7 @@ class AudioSetActiveDevicesFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class AudioSetPropertiesFunction : public SyncExtensionFunction {
+class AudioSetPropertiesFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("audio.setProperties",
AUDIO_SETPROPERTIES);
diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
index 2d152b7..260dfa6 100644
--- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
+++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
@@ -21,14 +21,14 @@ namespace extensions {
bool AutotestPrivateLogoutFunction::RunImpl() {
DVLOG(1) << "AutotestPrivateLogoutFunction";
- if (!AutotestPrivateAPIFactory::GetForProfile(profile())->test_mode())
+ if (!AutotestPrivateAPIFactory::GetForProfile(GetProfile())->test_mode())
chrome::AttemptUserExit();
return true;
}
bool AutotestPrivateRestartFunction::RunImpl() {
DVLOG(1) << "AutotestPrivateRestartFunction";
- if (!AutotestPrivateAPIFactory::GetForProfile(profile())->test_mode())
+ if (!AutotestPrivateAPIFactory::GetForProfile(GetProfile())->test_mode())
chrome::AttemptRestart();
return true;
}
@@ -42,12 +42,12 @@ bool AutotestPrivateShutdownFunction::RunImpl() {
#if defined(OS_CHROMEOS)
if (params->force) {
- if (!AutotestPrivateAPIFactory::GetForProfile(profile())->test_mode())
+ if (!AutotestPrivateAPIFactory::GetForProfile(GetProfile())->test_mode())
chrome::ExitCleanly();
return true;
}
#endif
- if (!AutotestPrivateAPIFactory::GetForProfile(profile())->test_mode())
+ if (!AutotestPrivateAPIFactory::GetForProfile(GetProfile())->test_mode())
chrome::AttemptExit();
return true;
}
@@ -113,7 +113,7 @@ static int AccessArray(const volatile int arr[], const volatile int *index) {
bool AutotestPrivateSimulateAsanMemoryBugFunction::RunImpl() {
DVLOG(1) << "AutotestPrivateSimulateAsanMemoryBugFunction";
- if (!AutotestPrivateAPIFactory::GetForProfile(profile())->test_mode()) {
+ if (!AutotestPrivateAPIFactory::GetForProfile(GetProfile())->test_mode()) {
// This array is volatile not to let compiler optimize us out.
volatile int testarray[3] = {0, 0, 0};
diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.h b/chrome/browser/extensions/api/autotest_private/autotest_private_api.h
index 8c3e117..fb1ba74 100644
--- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.h
+++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.h
@@ -8,12 +8,12 @@
#include <string>
#include "base/compiler_specific.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
namespace extensions {
-class AutotestPrivateLogoutFunction : public SyncExtensionFunction {
+class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT)
@@ -22,7 +22,7 @@ class AutotestPrivateLogoutFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class AutotestPrivateRestartFunction: public SyncExtensionFunction {
+class AutotestPrivateRestartFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("autotestPrivate.restart", AUTOTESTPRIVATE_RESTART)
@@ -31,7 +31,7 @@ class AutotestPrivateRestartFunction: public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class AutotestPrivateShutdownFunction: public SyncExtensionFunction {
+class AutotestPrivateShutdownFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("autotestPrivate.shutdown",
AUTOTESTPRIVATE_SHUTDOWN)
@@ -41,7 +41,7 @@ class AutotestPrivateShutdownFunction: public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class AutotestPrivateLoginStatusFunction: public SyncExtensionFunction {
+class AutotestPrivateLoginStatusFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("autotestPrivate.loginStatus",
AUTOTESTPRIVATE_LOGINSTATUS)
@@ -51,7 +51,7 @@ class AutotestPrivateLoginStatusFunction: public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class AutotestPrivateLockScreenFunction: public SyncExtensionFunction {
+class AutotestPrivateLockScreenFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("autotestPrivate.lockScreen",
AUTOTESTPRIVATE_LOCKSCREEN)
@@ -62,7 +62,7 @@ class AutotestPrivateLockScreenFunction: public SyncExtensionFunction {
};
class AutotestPrivateSimulateAsanMemoryBugFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("autotestPrivate.simulateAsanMemoryBug",
AUTOTESTPRIVATE_SIMULATEASANMEMORYBUG)
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
index d48d2e8..b7fadfd 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
@@ -134,7 +134,7 @@ bool BluetoothAddProfileFunction::RunImpl() {
uuid_ = device::bluetooth_utils::CanonicalUuid(params->profile.uuid);
- if (GetEventRouter(profile())->HasProfile(uuid_)) {
+ if (GetEventRouter(GetProfile())->HasProfile(uuid_)) {
SetError(kProfileAlreadyRegistered);
return false;
}
@@ -182,7 +182,7 @@ void BluetoothAddProfileFunction::OnProfileRegistered(
return;
}
- if (GetEventRouter(profile())->HasProfile(uuid_)) {
+ if (GetEventRouter(GetProfile())->HasProfile(uuid_)) {
bluetooth_profile->Unregister();
SetError(kProfileAlreadyRegistered);
SendResponse(false);
@@ -191,10 +191,10 @@ void BluetoothAddProfileFunction::OnProfileRegistered(
bluetooth_profile->SetConnectionCallback(
base::Bind(&ExtensionBluetoothEventRouter::DispatchConnectionEvent,
- base::Unretained(GetEventRouter(profile())),
+ base::Unretained(GetEventRouter(GetProfile())),
extension_id(),
uuid_));
- GetEventRouter(profile())->AddProfile(uuid_, bluetooth_profile);
+ GetEventRouter(GetProfile())->AddProfile(uuid_, bluetooth_profile);
SendResponse(true);
}
@@ -210,12 +210,12 @@ bool BluetoothRemoveProfileFunction::RunImpl() {
std::string uuid =
device::bluetooth_utils::CanonicalUuid(params->profile.uuid);
- if (!GetEventRouter(profile())->HasProfile(uuid)) {
+ if (!GetEventRouter(GetProfile())->HasProfile(uuid)) {
SetError(kProfileNotFound);
return false;
}
- GetEventRouter(profile())->RemoveProfile(uuid);
+ GetEventRouter(GetProfile())->RemoveProfile(uuid);
return true;
}
@@ -266,7 +266,7 @@ void BluetoothGetDevicesFunction::DispatchDeviceSearchResult(
const BluetoothDevice& device) {
bluetooth::Device extension_device;
bluetooth::BluetoothDeviceToApiDevice(device, &extension_device);
- GetEventRouter(profile())->DispatchDeviceEvent(
+ GetEventRouter(GetProfile())->DispatchDeviceEvent(
extensions::event_names::kBluetoothOnDeviceSearchResult,
extension_device);
@@ -281,8 +281,9 @@ void BluetoothGetDevicesFunction::FinishDeviceSearch() {
scoped_ptr<extensions::Event> event(new extensions::Event(
extensions::event_names::kBluetoothOnDeviceSearchFinished, args.Pass()));
- extensions::ExtensionSystem::Get(profile())->event_router()->
- BroadcastEvent(event.Pass());
+ extensions::ExtensionSystem::Get(GetProfile())
+ ->event_router()
+ ->BroadcastEvent(event.Pass());
SendResponse(true);
}
@@ -398,7 +399,7 @@ bool BluetoothConnectFunction::DoWork(scoped_refptr<BluetoothAdapter> adapter) {
options.profile.uuid);
BluetoothProfile* bluetooth_profile =
- GetEventRouter(profile())->GetProfile(uuid);
+ GetEventRouter(GetProfile())->GetProfile(uuid);
if (!bluetooth_profile) {
SetError(kProfileNotFound);
SendResponse(false);
@@ -417,7 +418,7 @@ bool BluetoothDisconnectFunction::RunImpl() {
scoped_ptr<Disconnect::Params> params(Disconnect::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
const bluetooth::DisconnectOptions& options = params->options;
- return GetEventRouter(profile())->ReleaseSocket(options.socket.id);
+ return GetEventRouter(GetProfile())->ReleaseSocket(options.socket.id);
}
BluetoothReadFunction::BluetoothReadFunction() : success_(false) {}
@@ -428,7 +429,7 @@ bool BluetoothReadFunction::Prepare() {
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
const bluetooth::ReadOptions& options = params->options;
- socket_ = GetEventRouter(profile())->GetSocket(options.socket.id);
+ socket_ = GetEventRouter(GetProfile())->GetSocket(options.socket.id);
if (socket_.get() == NULL) {
SetError(kSocketNotFoundError);
return false;
@@ -476,7 +477,7 @@ bool BluetoothWriteFunction::Prepare() {
int socket_id;
EXTENSION_FUNCTION_VALIDATE(socket->GetInteger("id", &socket_id));
- socket_ = GetEventRouter(profile())->GetSocket(socket_id);
+ socket_ = GetEventRouter(GetProfile())->GetSocket(socket_id);
if (socket_.get() == NULL) {
SetError(kSocketNotFoundError);
return false;
@@ -622,20 +623,20 @@ void BluetoothStartDiscoveryFunction::OnSuccessCallback() {
void BluetoothStartDiscoveryFunction::OnErrorCallback() {
SetError(kStartDiscoveryFailed);
- GetEventRouter(profile())->SetResponsibleForDiscovery(false);
+ GetEventRouter(GetProfile())->SetResponsibleForDiscovery(false);
SendResponse(false);
- GetEventRouter(profile())->OnListenerRemoved();
+ GetEventRouter(GetProfile())->OnListenerRemoved();
}
bool BluetoothStartDiscoveryFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) {
- GetEventRouter(profile())->SetSendDiscoveryEvents(true);
+ GetEventRouter(GetProfile())->SetSendDiscoveryEvents(true);
// If this profile is already discovering devices, there should be nothing
// else to do.
- if (!GetEventRouter(profile())->IsResponsibleForDiscovery()) {
- GetEventRouter(profile())->SetResponsibleForDiscovery(true);
- GetEventRouter(profile())->OnListenerAdded();
+ if (!GetEventRouter(GetProfile())->IsResponsibleForDiscovery()) {
+ GetEventRouter(GetProfile())->SetResponsibleForDiscovery(true);
+ GetEventRouter(GetProfile())->OnListenerAdded();
adapter->StartDiscovering(
base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this),
base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this));
@@ -646,20 +647,20 @@ bool BluetoothStartDiscoveryFunction::DoWork(
void BluetoothStopDiscoveryFunction::OnSuccessCallback() {
SendResponse(true);
- GetEventRouter(profile())->OnListenerRemoved();
+ GetEventRouter(GetProfile())->OnListenerRemoved();
}
void BluetoothStopDiscoveryFunction::OnErrorCallback() {
SetError(kStopDiscoveryFailed);
- GetEventRouter(profile())->SetResponsibleForDiscovery(true);
+ GetEventRouter(GetProfile())->SetResponsibleForDiscovery(true);
SendResponse(false);
- GetEventRouter(profile())->OnListenerRemoved();
+ GetEventRouter(GetProfile())->OnListenerRemoved();
}
bool BluetoothStopDiscoveryFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) {
- GetEventRouter(profile())->SetSendDiscoveryEvents(false);
- if (GetEventRouter(profile())->IsResponsibleForDiscovery()) {
+ GetEventRouter(GetProfile())->SetSendDiscoveryEvents(false);
+ if (GetEventRouter(GetProfile())->IsResponsibleForDiscovery()) {
adapter->StopDiscovering(
base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this),
base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this));
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h b/chrome/browser/extensions/api/bluetooth/bluetooth_api.h
index f97cf95..01dbe00 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.h
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.h
@@ -57,7 +57,7 @@ class BluetoothAPI : public BrowserContextKeyedService,
namespace api {
-class BluetoothAddProfileFunction : public AsyncExtensionFunction {
+class BluetoothAddProfileFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetooth.addProfile", BLUETOOTH_ADDPROFILE)
@@ -77,7 +77,7 @@ class BluetoothAddProfileFunction : public AsyncExtensionFunction {
std::string uuid_;
};
-class BluetoothRemoveProfileFunction : public SyncExtensionFunction {
+class BluetoothRemoveProfileFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetooth.removeProfile",
BLUETOOTH_REMOVEPROFILE)
@@ -161,7 +161,7 @@ class BluetoothConnectFunction : public BluetoothExtensionFunction {
void OnErrorCallback();
};
-class BluetoothDisconnectFunction : public SyncExtensionFunction {
+class BluetoothDisconnectFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetooth.disconnect", BLUETOOTH_DISCONNECT)
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
index 3b6baa8..f3f6073 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
@@ -43,12 +43,12 @@ BluetoothExtensionFunction::~BluetoothExtensionFunction() {
}
bool BluetoothExtensionFunction::RunImpl() {
- if (!IsBluetoothSupported(profile())) {
+ if (!IsBluetoothSupported(GetProfile())) {
SetError(kPlatformNotSupported);
return false;
}
GetAdapter(base::Bind(&BluetoothExtensionFunction::RunOnAdapterReady, this),
- profile());
+ GetProfile());
return true;
}
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h
index d24f654..44812db 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h
@@ -7,7 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace device {
@@ -22,7 +22,7 @@ namespace api {
// Base class for bluetooth extension functions. This class initializes
// bluetooth adapter and calls DoWork() implemented by individual bluetooth
// extension functions.
-class BluetoothExtensionFunction : public AsyncExtensionFunction {
+class BluetoothExtensionFunction : public ChromeAsyncExtensionFunction {
public:
BluetoothExtensionFunction();
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
index c77899b..6697a47 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -235,7 +235,7 @@ void BookmarkManagerPrivateEventRouter::ClearBookmarkNodeData() {
bool ClipboardBookmarkManagerFunction::CopyOrCut(bool cut,
const std::vector<std::string>& id_list) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
std::vector<const BookmarkNode*> nodes;
EXTENSION_FUNCTION_VALIDATE(GetNodesFromVector(model, id_list, &nodes));
bookmark_utils::CopyToClipboard(model, nodes, cut);
@@ -263,7 +263,7 @@ bool BookmarkManagerPrivatePasteFunction::RunImpl() {
scoped_ptr<Paste::Params> params(Paste::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id);
if (!parent_node) {
error_ = bookmark_keys::kNoParentError;
@@ -297,7 +297,7 @@ bool BookmarkManagerPrivateCanPasteFunction::RunImpl() {
scoped_ptr<CanPaste::Params> params(CanPaste::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id);
if (!parent_node) {
error_ = bookmark_keys::kNoParentError;
@@ -315,7 +315,7 @@ bool BookmarkManagerPrivateSortChildrenFunction::RunImpl() {
scoped_ptr<SortChildren::Params> params(SortChildren::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* parent_node = GetNodeFromString(model, params->parent_id);
if (!parent_node) {
error_ = bookmark_keys::kNoParentError;
@@ -411,7 +411,7 @@ bool BookmarkManagerPrivateStartDragFunction::RunImpl() {
scoped_ptr<StartDrag::Params> params(StartDrag::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
std::vector<const BookmarkNode*> nodes;
EXTENSION_FUNCTION_VALIDATE(
GetNodesFromVector(model, params->id_list, &nodes));
@@ -422,8 +422,8 @@ bool BookmarkManagerPrivateStartDragFunction::RunImpl() {
WebContents* web_contents =
dispatcher()->delegate()->GetAssociatedWebContents();
CHECK(web_contents);
- chrome::DragBookmarks(profile(), nodes,
- web_contents->GetView()->GetNativeView());
+ chrome::DragBookmarks(
+ GetProfile(), nodes, web_contents->GetView()->GetNativeView());
return true;
} else {
@@ -439,7 +439,7 @@ bool BookmarkManagerPrivateDropFunction::RunImpl() {
scoped_ptr<Drop::Params> params(Drop::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* drop_parent = GetNodeFromString(model, params->parent_id);
if (!drop_parent) {
@@ -471,7 +471,7 @@ bool BookmarkManagerPrivateDropFunction::RunImpl() {
NOTREACHED() <<"Somehow we're dropping null bookmark data";
return false;
}
- chrome::DropBookmarks(profile(), *drag_data, drop_parent, drop_index);
+ chrome::DropBookmarks(GetProfile(), *drag_data, drop_parent, drop_index);
router->ClearBookmarkNodeData();
return true;
@@ -485,7 +485,7 @@ bool BookmarkManagerPrivateGetSubtreeFunction::RunImpl() {
scoped_ptr<GetSubtree::Params> params(GetSubtree::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* node = NULL;
if (params->id == "") {
@@ -514,7 +514,7 @@ bool BookmarkManagerPrivateGetSubtreeFunction::RunImpl() {
}
bool BookmarkManagerPrivateCanEditFunction::RunImpl() {
- PrefService* prefs = user_prefs::UserPrefs::Get(profile_);
+ PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
SetResult(new base::FundamentalValue(
prefs->GetBoolean(prefs::kEditBookmarksEnabled)));
return true;
@@ -541,7 +541,7 @@ bool BookmarkManagerPrivateRemoveTreesFunction::RunImpl() {
scoped_ptr<RemoveTrees::Params> params(RemoveTrees::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
int64 id;
for (size_t i = 0; i < params->id_list.size(); ++i) {
if (!base::StringToInt64(params->id_list[i], &id)) {
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
index 1737525..fef3468 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
@@ -8,7 +8,7 @@
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
struct BookmarkNodeData;
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
index d3b3af5..1afca6a 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -97,7 +97,7 @@ base::FilePath GetDefaultFilepathForBookmarkExport() {
} // namespace
void BookmarksFunction::Run() {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
if (!model->loaded()) {
// Bookmarks are not ready yet. We'll wait.
model->AddObserver(this);
@@ -125,7 +125,7 @@ bool BookmarksFunction::GetBookmarkIdAsInt64(const std::string& id_string,
}
bool BookmarksFunction::EditBookmarksEnabled() {
- PrefService* prefs = user_prefs::UserPrefs::Get(profile_);
+ PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
if (prefs->GetBoolean(prefs::kEditBookmarksEnabled))
return true;
error_ = keys::kEditBookmarksDisabled;
@@ -326,7 +326,7 @@ bool BookmarksGetFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
std::vector<linked_ptr<BookmarkTreeNode> > nodes;
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
if (params->id_or_id_list.as_strings) {
std::vector<std::string>& ids = *params->id_or_id_list.as_strings;
size_t count = ids.size();
@@ -370,7 +370,7 @@ bool BookmarksGetChildrenFunction::RunImpl() {
std::vector<linked_ptr<BookmarkTreeNode> > nodes;
const BookmarkNode* node =
- BookmarkModelFactory::GetForProfile(profile())->GetNodeByID(id);
+ BookmarkModelFactory::GetForProfile(GetProfile())->GetNodeByID(id);
if (!node) {
error_ = keys::kNoNodeError;
return false;
@@ -394,7 +394,7 @@ bool BookmarksGetRecentFunction::RunImpl() {
std::vector<const BookmarkNode*> nodes;
bookmark_utils::GetMostRecentlyAddedEntries(
- BookmarkModelFactory::GetForProfile(profile()),
+ BookmarkModelFactory::GetForProfile(GetProfile()),
params->number_of_items,
&nodes);
@@ -412,7 +412,7 @@ bool BookmarksGetRecentFunction::RunImpl() {
bool BookmarksGetTreeFunction::RunImpl() {
std::vector<linked_ptr<BookmarkTreeNode> > nodes;
const BookmarkNode* node =
- BookmarkModelFactory::GetForProfile(profile())->root_node();
+ BookmarkModelFactory::GetForProfile(GetProfile())->root_node();
bookmark_api_helpers::AddNode(node, &nodes, true);
results_ = bookmarks::GetTree::Results::Create(nodes);
return true;
@@ -428,7 +428,7 @@ bool BookmarksGetSubTreeFunction::RunImpl() {
return false;
const BookmarkNode* node =
- BookmarkModelFactory::GetForProfile(profile())->GetNodeByID(id);
+ BookmarkModelFactory::GetForProfile(GetProfile())->GetNodeByID(id);
if (!node) {
error_ = keys::kNoNodeError;
return false;
@@ -445,11 +445,11 @@ bool BookmarksSearchFunction::RunImpl() {
bookmarks::Search::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- PrefService* prefs = user_prefs::UserPrefs::Get(profile_);
+ PrefService* prefs = user_prefs::UserPrefs::Get(GetProfile());
std::string lang = prefs->GetString(prefs::kAcceptLanguages);
std::vector<const BookmarkNode*> nodes;
bookmark_utils::GetBookmarksContainingText(
- BookmarkModelFactory::GetForProfile(profile()),
+ BookmarkModelFactory::GetForProfile(GetProfile()),
UTF8ToUTF16(params->query),
std::numeric_limits<int>::max(),
lang,
@@ -498,7 +498,7 @@ bool BookmarksRemoveFunction::RunImpl() {
if (name() == BookmarksRemoveTreeFunction::function_name())
recursive = true;
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
if (!bookmark_api_helpers::RemoveNode(model, id, recursive, &error_))
return false;
@@ -513,7 +513,7 @@ bool BookmarksCreateFunction::RunImpl() {
bookmarks::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
int64 parentId;
if (!params->bookmark.parent_id.get()) {
@@ -598,7 +598,7 @@ bool BookmarksMoveFunction::RunImpl() {
return false;
}
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
const BookmarkNode* node = model->GetNodeByID(id);
if (!node) {
error_ = keys::kNoNodeError;
@@ -672,7 +672,7 @@ bool BookmarksUpdateFunction::RunImpl() {
return false;
}
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(GetProfile());
// Optional but we need to distinguish non present from an empty title.
string16 title;
@@ -877,7 +877,7 @@ class BookmarksQuotaLimitFactory {
// And finally, building the individual heuristics for each function.
void BookmarksRemoveFunction::GetQuotaLimitHeuristics(
QuotaLimitHeuristics* heuristics) const {
- BookmarksQuotaLimitFactory::BuildForRemove(heuristics, profile());
+ BookmarksQuotaLimitFactory::BuildForRemove(heuristics, GetProfile());
}
void BookmarksMoveFunction::GetQuotaLimitHeuristics(
@@ -892,7 +892,7 @@ void BookmarksUpdateFunction::GetQuotaLimitHeuristics(
void BookmarksCreateFunction::GetQuotaLimitHeuristics(
QuotaLimitHeuristics* heuristics) const {
- BookmarksQuotaLimitFactory::BuildForCreate(heuristics, profile());
+ BookmarksQuotaLimitFactory::BuildForCreate(heuristics, GetProfile());
}
BookmarksIOFunction::BookmarksIOFunction() {}
@@ -996,9 +996,9 @@ void BookmarksImportFunction::FileSelected(const base::FilePath& path,
source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE;
source_profile.source_path = path;
importer_host->StartImportSettings(source_profile,
- profile(),
+ GetProfile(),
importer::FAVORITES,
- new ProfileWriter(profile()));
+ new ProfileWriter(GetProfile()));
importer::LogImporterUseToMetrics("BookmarksAPI",
importer::TYPE_BOOKMARKS_FILE);
@@ -1018,7 +1018,7 @@ void BookmarksExportFunction::FileSelected(const base::FilePath& path,
// Android does not have support for the standard exporter.
// TODO(jgreenwald): remove ifdef once extensions are no longer built on
// Android.
- bookmark_html_writer::WriteBookmarks(profile(), path, NULL);
+ bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL);
#endif
Release(); // Balanced in BookmarksIOFunction::SelectFile()
}
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
index 4e7c978..4d673c5 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h
@@ -13,8 +13,8 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "ui/shell_dialogs/select_file_dialog.h"
class Profile;
@@ -100,7 +100,7 @@ class BookmarksAPI : public ProfileKeyedAPI,
scoped_ptr<BookmarkEventRouter> bookmark_event_router_;
};
-class BookmarksFunction : public AsyncExtensionFunction,
+class BookmarksFunction : public ChromeAsyncExtensionFunction,
public BaseBookmarkModelObserver {
public:
// AsyncExtensionFunction:
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
index b9a32c4..7078525 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc
@@ -114,7 +114,7 @@ bool IsRemovalPermitted(int removal_mask, PrefService* prefs) {
bool BrowsingDataSettingsFunction::RunImpl() {
- PrefService* prefs = profile()->GetPrefs();
+ PrefService* prefs = GetProfile()->GetPrefs();
// Fill origin types.
// The "cookies" and "hosted apps" UI checkboxes both map to
@@ -211,8 +211,8 @@ void BrowsingDataSettingsFunction::SetDetails(
base::DictionaryValue* permitted_dict,
const char* data_type,
bool is_selected) {
- bool is_permitted = IsRemovalPermitted(MaskForKey(data_type),
- profile()->GetPrefs());
+ bool is_permitted =
+ IsRemovalPermitted(MaskForKey(data_type), GetProfile()->GetPrefs());
selected_dict->SetBoolean(data_type, is_selected && is_permitted);
permitted_dict->SetBoolean(data_type, is_permitted);
}
@@ -226,7 +226,7 @@ void BrowsingDataRemoverFunction::OnBrowsingDataRemoverDone() {
bool BrowsingDataRemoverFunction::RunImpl() {
// If we don't have a profile, something's pretty wrong.
- DCHECK(profile());
+ DCHECK(GetProfile());
// Grab the initial |options| parameter, and parse out the arguments.
base::DictionaryValue* options;
@@ -254,7 +254,7 @@ bool BrowsingDataRemoverFunction::RunImpl() {
return false;
// Check for prohibited data types.
- if (!IsRemovalPermitted(removal_mask_, profile()->GetPrefs())) {
+ if (!IsRemovalPermitted(removal_mask_, GetProfile()->GetPrefs())) {
error_ = extension_browsing_data_api_constants::kDeleteProhibitedError;
return false;
}
@@ -263,11 +263,12 @@ bool BrowsingDataRemoverFunction::RunImpl() {
// If we're being asked to remove plugin data, check whether it's actually
// supported.
BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ BrowserThread::FILE,
+ FROM_HERE,
base::Bind(
&BrowsingDataRemoverFunction::CheckRemovingPluginDataSupported,
this,
- PluginPrefs::GetForProfile(profile())));
+ PluginPrefs::GetForProfile(GetProfile())));
} else {
StartRemoving();
}
@@ -300,8 +301,8 @@ void BrowsingDataRemoverFunction::StartRemoving() {
// that we're notified after removal) and call remove() with the arguments
// we've generated above. We can use a raw pointer here, as the browsing data
// remover is responsible for deleting itself once data removal is complete.
- BrowsingDataRemover* remover = BrowsingDataRemover::CreateForRange(profile(),
- remove_since_, base::Time::Max());
+ BrowsingDataRemover* remover = BrowsingDataRemover::CreateForRange(
+ GetProfile(), remove_since_, base::Time::Max());
remover->AddObserver(this);
remover->Remove(removal_mask_, origin_set_mask_);
}
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.h b/chrome/browser/extensions/api/browsing_data/browsing_data_api.h
index 1078ec2..4e1b7ce 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.h
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.h
@@ -12,7 +12,7 @@
#include <string>
#include "chrome/browser/browsing_data/browsing_data_remover.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
class PluginPrefs;
@@ -51,8 +51,7 @@ extern const char kOneAtATimeError[];
} // namespace extension_browsing_data_api_constants
-
-class BrowsingDataSettingsFunction : public SyncExtensionFunction {
+class BrowsingDataSettingsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("browsingData.settings", BROWSINGDATA_SETTINGS)
@@ -80,8 +79,8 @@ class BrowsingDataSettingsFunction : public SyncExtensionFunction {
//
// Each child class must implement GetRemovalMask(), which returns the bitmask
// of data types to remove.
-class BrowsingDataRemoverFunction : public AsyncExtensionFunction,
- public BrowsingDataRemover::Observer {
+class BrowsingDataRemoverFunction : public ChromeAsyncExtensionFunction,
+ public BrowsingDataRemover::Observer {
public:
// BrowsingDataRemover::Observer interface method.
virtual void OnBrowsingDataRemoverDone() OVERRIDE;
diff --git a/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc b/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc
index 48b551d..7362ab6 100644
--- a/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc
+++ b/chrome/browser/extensions/api/cast_channel/cast_channel_api.cc
@@ -100,7 +100,7 @@ CastChannelAsyncApiFunction::CastChannelAsyncApiFunction()
CastChannelAsyncApiFunction::~CastChannelAsyncApiFunction() { }
bool CastChannelAsyncApiFunction::PrePrepare() {
- manager_ = ApiResourceManager<CastSocket>::Get(profile());
+ manager_ = ApiResourceManager<CastSocket>::Get(GetProfile());
return true;
}
@@ -168,7 +168,7 @@ CastChannelOpenFunction::CastChannelOpenFunction()
CastChannelOpenFunction::~CastChannelOpenFunction() { }
bool CastChannelOpenFunction::PrePrepare() {
- api_ = CastChannelAPI::Get(profile());
+ api_ = CastChannelAPI::Get(GetProfile());
return CastChannelAsyncApiFunction::PrePrepare();
}
diff --git a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc
index e44a17d..ab18eae 100644
--- a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc
+++ b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.cc
@@ -49,15 +49,15 @@ bool CloudPrintPrivateSetupConnectorFunction::RunImpl() {
params->credentials,
params->user_settings);
} else {
- if (!CloudPrintProxyServiceFactory::GetForProfile(profile_))
+ if (!CloudPrintProxyServiceFactory::GetForProfile(GetProfile()))
return false;
scoped_ptr<base::DictionaryValue> user_setings(
params->user_settings.ToValue());
- CloudPrintProxyServiceFactory::GetForProfile(profile_)->
- EnableForUserWithRobot(params->credentials,
- params->robot_email,
- params->user_email,
- *user_setings);
+ CloudPrintProxyServiceFactory::GetForProfile(GetProfile())
+ ->EnableForUserWithRobot(params->credentials,
+ params->robot_email,
+ params->user_email,
+ *user_setings);
}
SendResponse(true);
#endif
diff --git a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h
index 53e824e..9da2d44 100644
--- a/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h
+++ b/chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
@@ -46,7 +46,8 @@ class CloudPrintTestsDelegate {
static CloudPrintTestsDelegate* instance_;
};
-class CloudPrintPrivateSetupConnectorFunction : public AsyncExtensionFunction {
+class CloudPrintPrivateSetupConnectorFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.setupConnector",
CLOUDPRINTPRIVATE_SETUPCONNECTOR)
@@ -60,7 +61,8 @@ class CloudPrintPrivateSetupConnectorFunction : public AsyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class CloudPrintPrivateGetHostNameFunction : public AsyncExtensionFunction {
+class CloudPrintPrivateGetHostNameFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getHostName",
CLOUDPRINTPRIVATE_GETHOSTNAME)
@@ -74,7 +76,8 @@ class CloudPrintPrivateGetHostNameFunction : public AsyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class CloudPrintPrivateGetPrintersFunction : public AsyncExtensionFunction {
+class CloudPrintPrivateGetPrintersFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getPrinters",
CLOUDPRINTPRIVATE_GETPRINTERS)
@@ -90,7 +93,8 @@ class CloudPrintPrivateGetPrintersFunction : public AsyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class CloudPrintPrivateGetClientIdFunction : public AsyncExtensionFunction {
+class CloudPrintPrivateGetClientIdFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("cloudPrintPrivate.getClientId",
CLOUDPRINTPRIVATE_GETCLIENTID);
diff --git a/chrome/browser/extensions/api/commands/commands.cc b/chrome/browser/extensions/api/commands/commands.cc
index 0b6f0e5..be1c95b 100644
--- a/chrome/browser/extensions/api/commands/commands.cc
+++ b/chrome/browser/extensions/api/commands/commands.cc
@@ -25,7 +25,7 @@ bool GetAllCommandsFunction::RunImpl() {
base::ListValue* command_list = new base::ListValue();
extensions::CommandService* command_service =
- extensions::CommandService::Get(profile_);
+ extensions::CommandService::Get(GetProfile());
extensions::Command browser_action;
bool active = false;
diff --git a/chrome/browser/extensions/api/commands/commands.h b/chrome/browser/extensions/api/commands/commands.h
index 9acb762..26bf708 100644
--- a/chrome/browser/extensions/api/commands/commands.h
+++ b/chrome/browser/extensions/api/commands/commands.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMANDS_H_
#define CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMANDS_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
-class GetAllCommandsFunction : public SyncExtensionFunction {
+class GetAllCommandsFunction : public ChromeSyncExtensionFunction {
virtual ~GetAllCommandsFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("commands.getAll", COMMANDS_GETALL)
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api.cc b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
index d939436..db3e637 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_api.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_api.cc
@@ -82,14 +82,15 @@ bool ContentSettingsContentSettingClearFunction::RunImpl() {
} else {
// Incognito profiles can't access regular mode ever, they only exist in
// split mode.
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = keys::kIncognitoContextError;
return false;
}
}
- ContentSettingsStore* store = extensions::ExtensionSystem::Get(profile_)->
- extension_service()->GetContentSettingsStore();
+ ContentSettingsStore* store = extensions::ExtensionSystem::Get(GetProfile())
+ ->extension_service()
+ ->GetContentSettingsStore();
store->ClearContentSettingsForExtension(extension_id(), scope);
return true;
@@ -134,18 +135,19 @@ bool ContentSettingsContentSettingGetFunction::RunImpl() {
HostContentSettingsMap* map;
CookieSettings* cookie_settings;
if (incognito) {
- if (!profile()->HasOffTheRecordProfile()) {
+ if (!GetProfile()->HasOffTheRecordProfile()) {
// TODO(bauerb): Allow reading incognito content settings
// outside of an incognito session.
error_ = keys::kIncognitoSessionOnlyError;
return false;
}
- map = profile()->GetOffTheRecordProfile()->GetHostContentSettingsMap();
+ map = GetProfile()->GetOffTheRecordProfile()->GetHostContentSettingsMap();
cookie_settings = CookieSettings::Factory::GetForProfile(
- profile()->GetOffTheRecordProfile()).get();
+ GetProfile()->GetOffTheRecordProfile()).get();
} else {
- map = profile()->GetHostContentSettingsMap();
- cookie_settings = CookieSettings::Factory::GetForProfile(profile()).get();
+ map = GetProfile()->GetHostContentSettingsMap();
+ cookie_settings =
+ CookieSettings::Factory::GetForProfile(GetProfile()).get();
}
ContentSetting setting;
@@ -206,10 +208,8 @@ bool ContentSettingsContentSettingSetFunction::RunImpl() {
ContentSetting setting;
EXTENSION_FUNCTION_VALIDATE(
helpers::StringToContentSetting(setting_str, &setting));
- EXTENSION_FUNCTION_VALIDATE(
- HostContentSettingsMap::IsSettingAllowedForType(profile()->GetPrefs(),
- setting,
- content_type));
+ EXTENSION_FUNCTION_VALIDATE(HostContentSettingsMap::IsSettingAllowedForType(
+ GetProfile()->GetPrefs(), setting, content_type));
ExtensionPrefsScope scope = kExtensionPrefsScopeRegular;
bool incognito = false;
@@ -221,27 +221,28 @@ bool ContentSettingsContentSettingSetFunction::RunImpl() {
if (incognito) {
// Regular profiles can't access incognito unless include_incognito is true.
- if (!profile()->IsOffTheRecord() && !include_incognito()) {
+ if (!GetProfile()->IsOffTheRecord() && !include_incognito()) {
error_ = pref_keys::kIncognitoErrorMessage;
return false;
}
} else {
// Incognito profiles can't access regular mode ever, they only exist in
// split mode.
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = keys::kIncognitoContextError;
return false;
}
}
if (scope == kExtensionPrefsScopeIncognitoSessionOnly &&
- !profile_->HasOffTheRecordProfile()) {
+ !GetProfile()->HasOffTheRecordProfile()) {
error_ = pref_keys::kIncognitoSessionOnlyErrorMessage;
return false;
}
- ContentSettingsStore* store = extensions::ExtensionSystem::Get(profile_)->
- extension_service()->GetContentSettingsStore();
+ ContentSettingsStore* store = extensions::ExtensionSystem::Get(GetProfile())
+ ->extension_service()
+ ->GetContentSettingsStore();
store->SetExtensionContentSetting(extension_id(), primary_pattern,
secondary_pattern, content_type,
resource_identifier, setting, scope);
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_api.h b/chrome/browser/extensions/api/content_settings/content_settings_api.h
index 820849f..b2e3beb 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_api.h
+++ b/chrome/browser/extensions/api/content_settings/content_settings_api.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
class PluginFinder;
@@ -16,7 +16,7 @@ struct WebPluginInfo;
namespace extensions {
class ContentSettingsContentSettingClearFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contentSettings.clear", CONTENTSETTINGS_CLEAR)
@@ -27,7 +27,8 @@ class ContentSettingsContentSettingClearFunction
virtual bool RunImpl() OVERRIDE;
};
-class ContentSettingsContentSettingGetFunction : public SyncExtensionFunction {
+class ContentSettingsContentSettingGetFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contentSettings.get", CONTENTSETTINGS_GET)
@@ -38,7 +39,8 @@ class ContentSettingsContentSettingGetFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class ContentSettingsContentSettingSetFunction : public SyncExtensionFunction {
+class ContentSettingsContentSettingSetFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contentSettings.set", CONTENTSETTINGS_SET)
@@ -50,7 +52,7 @@ class ContentSettingsContentSettingSetFunction : public SyncExtensionFunction {
};
class ContentSettingsContentSettingGetResourceIdentifiersFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contentSettings.getResourceIdentifiers",
CONTENTSETTINGS_GETRESOURCEIDENTIFIERS)
diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api.cc b/chrome/browser/extensions/api/context_menus/context_menus_api.cc
index de30534..1c3eb67 100644
--- a/chrome/browser/extensions/api/context_menus/context_menus_api.cc
+++ b/chrome/browser/extensions/api/context_menus/context_menus_api.cc
@@ -153,7 +153,7 @@ namespace Remove = api::context_menus::Remove;
namespace Update = api::context_menus::Update;
bool ContextMenusCreateFunction::RunImpl() {
- MenuItem::Id id(profile()->IsOffTheRecord(), extension_id());
+ MenuItem::Id id(GetProfile()->IsOffTheRecord(), extension_id());
scoped_ptr<Create::Params> params(Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -176,7 +176,8 @@ bool ContextMenusCreateFunction::RunImpl() {
if (params->create_properties.title.get())
title = *params->create_properties.title;
- MenuManager* menu_manager = profile()->GetExtensionService()->menu_manager();
+ MenuManager* menu_manager =
+ GetProfile()->GetExtensionService()->menu_manager();
if (menu_manager->GetItemById(id)) {
error_ = ErrorUtils::FormatErrorMessage(kDuplicateIDError,
@@ -229,7 +230,7 @@ bool ContextMenusCreateFunction::RunImpl() {
bool success = true;
scoped_ptr<MenuItem::Id> parent_id(GetParentId(params->create_properties,
- profile()->IsOffTheRecord(),
+ GetProfile()->IsOffTheRecord(),
extension_id()));
if (parent_id.get()) {
MenuItem* parent = GetParent(*parent_id, menu_manager, &error_);
@@ -249,7 +250,7 @@ bool ContextMenusCreateFunction::RunImpl() {
bool ContextMenusUpdateFunction::RunImpl() {
bool radio_item_updated = false;
- MenuItem::Id item_id(profile()->IsOffTheRecord(), extension_id());
+ MenuItem::Id item_id(GetProfile()->IsOffTheRecord(), extension_id());
scoped_ptr<Update::Params> params(Update::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -260,7 +261,7 @@ bool ContextMenusUpdateFunction::RunImpl() {
else
NOTREACHED();
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
MenuManager* manager = service->menu_manager();
MenuItem* item = manager->GetItemById(item_id);
if (!item || item->extension_id() != extension_id()) {
@@ -328,7 +329,7 @@ bool ContextMenusUpdateFunction::RunImpl() {
// Parent id.
MenuItem* parent = NULL;
scoped_ptr<MenuItem::Id> parent_id(GetParentId(params->update_properties,
- profile()->IsOffTheRecord(),
+ GetProfile()->IsOffTheRecord(),
extension_id()));
if (parent_id.get()) {
MenuItem* parent = GetParent(*parent_id, manager, &error_);
@@ -356,10 +357,10 @@ bool ContextMenusRemoveFunction::RunImpl() {
scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
MenuManager* manager = service->menu_manager();
- MenuItem::Id id(profile()->IsOffTheRecord(), extension_id());
+ MenuItem::Id id(GetProfile()->IsOffTheRecord(), extension_id());
if (params->menu_item_id.as_string)
id.string_uid = *params->menu_item_id.as_string;
else if (params->menu_item_id.as_integer)
@@ -382,7 +383,7 @@ bool ContextMenusRemoveFunction::RunImpl() {
}
bool ContextMenusRemoveAllFunction::RunImpl() {
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
MenuManager* manager = service->menu_manager();
manager->RemoveAllContextItems(GetExtension()->id());
manager->WriteToStorage(GetExtension());
diff --git a/chrome/browser/extensions/api/context_menus/context_menus_api.h b/chrome/browser/extensions/api/context_menus/context_menus_api.h
index 91d0728..2e05f26 100644
--- a/chrome/browser/extensions/api/context_menus/context_menus_api.h
+++ b/chrome/browser/extensions/api/context_menus/context_menus_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
-class ContextMenusCreateFunction : public SyncExtensionFunction {
+class ContextMenusCreateFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contextMenus.create", CONTEXTMENUS_CREATE)
@@ -20,7 +20,7 @@ class ContextMenusCreateFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class ContextMenusUpdateFunction : public SyncExtensionFunction {
+class ContextMenusUpdateFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contextMenus.update", CONTEXTMENUS_UPDATE)
@@ -31,7 +31,7 @@ class ContextMenusUpdateFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class ContextMenusRemoveFunction : public SyncExtensionFunction {
+class ContextMenusRemoveFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contextMenus.remove", CONTEXTMENUS_REMOVE)
@@ -42,7 +42,7 @@ class ContextMenusRemoveFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class ContextMenusRemoveAllFunction : public SyncExtensionFunction {
+class ContextMenusRemoveAllFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("contextMenus.removeAll", CONTEXTMENUS_REMOVEALL)
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index 079be55..4a6138c 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -170,7 +170,7 @@ bool CookiesFunction::ParseStoreContext(
Profile* store_profile = NULL;
if (!store_id->empty()) {
store_profile = cookies_helpers::ChooseProfileFromStoreId(
- *store_id, profile(), include_incognito());
+ *store_id, GetProfile(), include_incognito());
if (!store_profile) {
error_ = ErrorUtils::FormatErrorMessage(
keys::kInvalidStoreIdError, *store_id);
@@ -513,13 +513,13 @@ void CookiesRemoveFunction::RespondOnUIThread() {
}
bool CookiesGetAllCookieStoresFunction::RunImpl() {
- Profile* original_profile = profile();
+ Profile* original_profile = GetProfile();
DCHECK(original_profile);
scoped_ptr<base::ListValue> original_tab_ids(new base::ListValue());
Profile* incognito_profile = NULL;
scoped_ptr<base::ListValue> incognito_tab_ids;
- if (include_incognito() && profile()->HasOffTheRecordProfile()) {
- incognito_profile = profile()->GetOffTheRecordProfile();
+ if (include_incognito() && GetProfile()->HasOffTheRecordProfile()) {
+ incognito_profile = GetProfile()->GetOffTheRecordProfile();
if (incognito_profile)
incognito_tab_ids.reset(new base::ListValue());
}
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.h b/chrome/browser/extensions/api/cookies/cookies_api.h
index 8dbc0a4..38e7438 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.h
+++ b/chrome/browser/extensions/api/cookies/cookies_api.h
@@ -14,8 +14,8 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
#include "chrome/common/extensions/api/cookies.h"
#include "content/public/browser/notification_observer.h"
@@ -67,7 +67,7 @@ class CookiesEventRouter : public content::NotificationObserver {
// concurrently accessed from multiple threads. They modify |result_| and other
// member variables directly.
// See chrome/browser/extensions/extension_function.h for more information.
-class CookiesFunction : public AsyncExtensionFunction {
+class CookiesFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~CookiesFunction() {}
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index 32abf2e..2c49d80 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -487,9 +487,13 @@ void DebuggerFunction::FormatErrorMessage(const std::string& format) {
bool DebuggerFunction::InitAgentHost() {
if (debuggee_.tab_id) {
WebContents* web_contents = NULL;
- bool result = ExtensionTabUtil::GetTabById(
- *debuggee_.tab_id, profile(), include_incognito(), NULL, NULL,
- &web_contents, NULL);
+ bool result = ExtensionTabUtil::GetTabById(*debuggee_.tab_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ NULL,
+ &web_contents,
+ NULL);
if (result && web_contents) {
if (content::HasWebUIScheme(web_contents->GetURL())) {
error_ = ErrorUtils::FormatErrorMessage(
@@ -502,8 +506,9 @@ bool DebuggerFunction::InitAgentHost() {
}
} else if (debuggee_.extension_id) {
extensions::ExtensionHost* extension_host =
- extensions::ExtensionSystem::Get(profile())->process_manager()->
- GetBackgroundHostForExtension(*debuggee_.extension_id);
+ extensions::ExtensionSystem::Get(GetProfile())
+ ->process_manager()
+ ->GetBackgroundHostForExtension(*debuggee_.extension_id);
if (extension_host) {
agent_host_ = DevToolsAgentHost::GetOrCreateFor(
extension_host->render_view_host());
@@ -581,9 +586,12 @@ bool DebuggerAttachFunction::RunImpl() {
}
}
- new ExtensionDevToolsClientHost(profile(), agent_host_.get(),
- GetExtension()->id(), GetExtension()->name(),
- debuggee_, infobar);
+ new ExtensionDevToolsClientHost(GetProfile(),
+ agent_host_.get(),
+ GetExtension()->id(),
+ GetExtension()->name(),
+ debuggee_,
+ infobar);
SendResponse(true);
return true;
}
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.h b/chrome/browser/extensions/api/debugger/debugger_api.h
index 8f3561b..4581e2c 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.h
+++ b/chrome/browser/extensions/api/debugger/debugger_api.h
@@ -10,7 +10,7 @@
#include <string>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/debugger.h"
#include "content/public/browser/worker_service.h"
@@ -29,7 +29,7 @@ class DevToolsAgentHost;
class WebContents;
}
-class DebuggerFunction : public AsyncExtensionFunction {
+class DebuggerFunction : public ChromeAsyncExtensionFunction {
protected:
DebuggerFunction();
virtual ~DebuggerFunction();
diff --git a/chrome/browser/extensions/api/declarative/declarative_api.cc b/chrome/browser/extensions/api/declarative/declarative_api.cc
index 9f2f5cc..a77a6bd 100644
--- a/chrome/browser/extensions/api/declarative/declarative_api.cc
+++ b/chrome/browser/extensions/api/declarative/declarative_api.cc
@@ -42,7 +42,7 @@ bool RulesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name));
RulesRegistryService* rules_registry_service =
- RulesRegistryService::Get(profile());
+ RulesRegistryService::Get(GetProfile());
rules_registry_ = rules_registry_service->GetRulesRegistry(event_name);
// Raw access to this function is not available to extensions, therefore
// there should never be a request for a nonexisting rules registry.
diff --git a/chrome/browser/extensions/api/declarative/declarative_api.h b/chrome/browser/extensions/api/declarative/declarative_api.h
index 90e0e99..f740a3e 100644
--- a/chrome/browser/extensions/api/declarative/declarative_api.h
+++ b/chrome/browser/extensions/api/declarative/declarative_api.h
@@ -8,11 +8,11 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/api/declarative/rules_registry.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
-class RulesFunction : public AsyncExtensionFunction {
+class RulesFunction : public ChromeAsyncExtensionFunction {
public:
RulesFunction();
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
index 4c00e25..0fe1a83 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc
@@ -96,9 +96,13 @@ bool DesktopCaptureChooseDesktopMediaFunction::RunImpl() {
}
content::WebContents* web_contents = NULL;
- if (!ExtensionTabUtil::GetTabById(
- *(params->target_tab->id), profile(), false,
- NULL, NULL, &web_contents, NULL)) {
+ if (!ExtensionTabUtil::GetTabById(*(params->target_tab->id),
+ GetProfile(),
+ false,
+ NULL,
+ NULL,
+ &web_contents,
+ NULL)) {
error_ = kInvalidTabIdError;
return false;
}
diff --git a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h
index 2073547..2621d07 100644
--- a/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h
+++ b/chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h
@@ -8,7 +8,7 @@
#include <map>
#include "base/memory/singleton.h"
-#include "chrome/browser/extensions/api/api_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/media/desktop_media_picker.h"
#include "chrome/browser/media/desktop_media_picker_model.h"
#include "chrome/common/extensions/api/desktop_capture.h"
@@ -16,7 +16,8 @@
namespace extensions {
-class DesktopCaptureChooseDesktopMediaFunction : public AsyncExtensionFunction {
+class DesktopCaptureChooseDesktopMediaFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("desktopCapture.chooseDesktopMedia",
DESKTOPCAPTURE_CHOOSEDESKTOPMEDIA)
@@ -61,7 +62,7 @@ class DesktopCaptureChooseDesktopMediaFunction : public AsyncExtensionFunction {
};
class DesktopCaptureCancelChooseDesktopMediaFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("desktopCapture.cancelChooseDesktopMedia",
DESKTOPCAPTURE_CANCELCHOOSEDESKTOPMEDIA)
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index eb81a66e..55b0709 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -288,7 +288,7 @@ void DeveloperPrivateAPI::OnListenerRemoved(
namespace api {
bool DeveloperPrivateAutoUpdateFunction::RunImpl() {
- ExtensionUpdater* updater = GetExtensionUpdater(profile());
+ ExtensionUpdater* updater = GetExtensionUpdater(GetProfile());
if (updater)
updater->CheckNow(ExtensionUpdater::CheckParams());
SetResult(new base::FundamentalValue(true));
@@ -303,8 +303,8 @@ scoped_ptr<developer::ItemInfo>
bool item_is_enabled) {
scoped_ptr<developer::ItemInfo> info(new developer::ItemInfo());
- ExtensionSystem* system = ExtensionSystem::Get(profile());
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
+ ExtensionService* service = GetProfile()->GetExtensionService();
info->id = item.id();
info->name = item.name();
@@ -430,7 +430,7 @@ void DeveloperPrivateGetItemsInfoFunction::
GetShellWindowPagesForExtensionProfile(
const Extension* extension,
ItemInspectViewList* result) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
+ ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
if (!registry) return;
const ShellWindowRegistry::ShellWindowList windows =
@@ -486,7 +486,7 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction::
ItemInspectViewList result;
// Get the extension process's active views.
ExtensionProcessManager* process_manager =
- ExtensionSystem::Get(profile())->process_manager();
+ ExtensionSystem::Get(GetProfile())->process_manager();
GetInspectablePagesForExtensionProcess(
extension,
process_manager->GetRenderViewHostsForExtension(extension->id()),
@@ -507,7 +507,7 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction::
BackgroundInfo::HasGeneratedBackgroundPage(extension)));
}
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
// Repeat for the incognito process, if applicable. Don't try to get
// shell windows for incognito process.
if (service->profile()->HasOffTheRecordProfile() &&
@@ -544,7 +544,7 @@ bool DeveloperPrivateGetItemsInfoFunction::RunImpl() {
ExtensionSet items;
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
items.InsertAll(*service->extensions());
@@ -596,9 +596,9 @@ bool DeveloperPrivateAllowFileAccessFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(user_gesture_);
- ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
ManagementPolicy* management_policy = system->management_policy();
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
const Extension* extension = service->GetInstalledExtension(params->item_id);
bool result = true;
@@ -625,7 +625,7 @@ bool DeveloperPrivateAllowIncognitoFunction::RunImpl() {
AllowIncognito::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
const Extension* extension = service->GetInstalledExtension(params->item_id);
bool result = true;
@@ -646,7 +646,7 @@ bool DeveloperPrivateReloadFunction::RunImpl() {
scoped_ptr<Reload::Params> params(Reload::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
CHECK(!params->item_id.empty());
service->ReloadExtension(params->item_id);
return true;
@@ -654,9 +654,9 @@ bool DeveloperPrivateReloadFunction::RunImpl() {
bool DeveloperPrivateShowPermissionsDialogFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id_));
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
CHECK(!extension_id_.empty());
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
+ ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
@@ -671,8 +671,8 @@ bool DeveloperPrivateShowPermissionsDialogFunction::RunImpl() {
std::vector<base::FilePath> retained_file_paths;
if (extension->HasAPIPermission(extensions::APIPermission::kFileSystem)) {
std::vector<apps::SavedFileEntry> retained_file_entries =
- apps::SavedFilesService::Get(profile())->GetAllFileEntries(
- extension_id_);
+ apps::SavedFilesService::Get(GetProfile())
+ ->GetAllFileEntries(extension_id_);
for (size_t i = 0; i < retained_file_entries.size(); i++) {
retained_file_paths.push_back(retained_file_entries[i].path);
}
@@ -685,10 +685,12 @@ DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {}
// This is called when the user clicks "Revoke File Access."
void DeveloperPrivateShowPermissionsDialogFunction::InstallUIProceed() {
- apps::SavedFilesService::Get(profile())->ClearQueue(
- profile()->GetExtensionService()->GetExtensionById(extension_id_, true));
- if (apps::AppRestoreService::Get(profile())->IsAppRestorable(extension_id_))
- apps::AppLoadService::Get(profile())->RestartApplication(extension_id_);
+ apps::SavedFilesService::Get(GetProfile())
+ ->ClearQueue(GetProfile()->GetExtensionService()->GetExtensionById(
+ extension_id_, true));
+ if (apps::AppRestoreService::Get(GetProfile())
+ ->IsAppRestorable(extension_id_))
+ apps::AppLoadService::Get(GetProfile())->RestartApplication(extension_id_);
SendResponse(true);
Release();
}
@@ -713,9 +715,9 @@ bool DeveloperPrivateEnableFunction::RunImpl() {
std::string extension_id = params->item_id;
- ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
ManagementPolicy* management_policy = system->management_policy();
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
const Extension* extension = service->GetInstalledExtension(extension_id);
if (!extension ||
@@ -728,7 +730,7 @@ bool DeveloperPrivateEnableFunction::RunImpl() {
if (params->enable) {
ExtensionPrefs* prefs = service->extension_prefs();
if (prefs->DidExtensionEscalatePermissions(extension_id)) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
+ ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
CHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
@@ -769,7 +771,7 @@ void DeveloperPrivateEnableFunction::OnRequirementsChecked(
std::string extension_id,
std::vector<std::string> requirements_errors) {
if (requirements_errors.empty()) {
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
service->EnableExtension(extension_id);
} else {
ExtensionErrorReporter::GetInstance()->ReportError(
@@ -793,7 +795,7 @@ bool DeveloperPrivateInspectFunction::RunImpl() {
if (render_process_id == -1) {
// This is a lazy background page. Identify if it is a normal
// or incognito background page.
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
if (options.incognito)
service = ExtensionSystem::Get(
service->profile()->GetOffTheRecordProfile())->extension_service();
@@ -801,7 +803,7 @@ bool DeveloperPrivateInspectFunction::RunImpl() {
options.extension_id);
DCHECK(extension);
// Wakes up the background page and opens the inspect window.
- devtools_util::InspectBackgroundPage(extension, profile());
+ devtools_util::InspectBackgroundPage(extension, GetProfile());
return false;
}
@@ -829,7 +831,7 @@ bool DeveloperPrivateLoadUnpackedFunction::RunImpl() {
AddRef();
bool result = ShowPicker(
ui::SelectFileDialog::SELECT_FOLDER,
- DeveloperPrivateAPI::Get(profile())->GetLastUnpackedDirectory(),
+ DeveloperPrivateAPI::Get(GetProfile())->GetLastUnpackedDirectory(),
select_title,
ui::SelectFileDialog::FileTypeInfo(),
0);
@@ -838,9 +840,9 @@ bool DeveloperPrivateLoadUnpackedFunction::RunImpl() {
void DeveloperPrivateLoadUnpackedFunction::FileSelected(
const base::FilePath& path) {
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
UnpackedInstaller::Create(service)->Load(path);
- DeveloperPrivateAPI::Get(profile())->SetLastUnpackedDirectory(path);
+ DeveloperPrivateAPI::Get(GetProfile())->SetLastUnpackedDirectory(path);
SendResponse(true);
Release();
}
@@ -856,7 +858,7 @@ bool DeveloperPrivateChooseEntryFunction::ShowPicker(
const string16& select_title,
const ui::SelectFileDialog::FileTypeInfo& info,
int file_type_index) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
+ ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
@@ -970,10 +972,11 @@ bool DeveloperPrivateExportSyncfsFolderToLocalfsFunction::RunImpl() {
return false;
}
- context_ = content::BrowserContext::GetStoragePartition(profile(),
- render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ context_ = content::BrowserContext::GetStoragePartition(
+ GetProfile(), render_view_host()->GetSiteInstance())
+ ->GetFileSystemContext();
- base::FilePath project_path(profile()->GetPath());
+ base::FilePath project_path(GetProfile()->GetPath());
project_path = project_path.Append(kUnpackedAppsFolder);
project_path = project_path.Append(project_name);
@@ -1132,11 +1135,11 @@ bool DeveloperPrivateLoadProjectFunction::RunImpl() {
return false;
}
- base::FilePath path(profile()->GetPath());
+ base::FilePath path(GetProfile()->GetPath());
path = path.Append(kUnpackedAppsFolder);
// TODO(grv) : Sanitize / check project_name.
path = path.Append(project_name);
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
UnpackedInstaller::Create(service)->Load(path);
const ExtensionSet* extensions = service->extensions();
@@ -1204,7 +1207,7 @@ bool DeveloperPrivateChoosePathFunction::RunImpl() {
AddRef();
bool result = ShowPicker(
type,
- DeveloperPrivateAPI::Get(profile())->GetLastUnpackedDirectory(),
+ DeveloperPrivateAPI::Get(GetProfile())->GetLastUnpackedDirectory(),
select_title,
info,
file_type_index);
@@ -1340,7 +1343,7 @@ bool DeveloperPrivateGetStringsFunction::RunImpl() {
DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {}
bool DeveloperPrivateIsProfileManagedFunction::RunImpl() {
- SetResult(new base::FundamentalValue(profile_->IsManaged()));
+ SetResult(new base::FundamentalValue(GetProfile()->IsManaged()));
return true;
}
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
index ac5dc5c..e5f0721 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -8,8 +8,8 @@
#include "base/platform_file.h"
#include "chrome/browser/extensions/api/developer_private/entry_picker.h"
#include "chrome/browser/extensions/api/file_system/file_system_api.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/extensions/pack_extension_job.h"
@@ -116,7 +116,7 @@ class DeveloperPrivateAPI : public BrowserContextKeyedService,
namespace api {
-class DeveloperPrivateAutoUpdateFunction : public SyncExtensionFunction {
+class DeveloperPrivateAutoUpdateFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.autoUpdate",
DEVELOPERPRIVATE_AUTOUPDATE)
@@ -128,7 +128,8 @@ class DeveloperPrivateAutoUpdateFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DeveloperPrivateGetItemsInfoFunction : public AsyncExtensionFunction {
+class DeveloperPrivateGetItemsInfoFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.getItemsInfo",
DEVELOPERPRIVATE_GETITEMSINFO)
@@ -171,7 +172,7 @@ class DeveloperPrivateGetItemsInfoFunction : public AsyncExtensionFunction {
bool generated_background_page);
};
-class DeveloperPrivateInspectFunction : public SyncExtensionFunction {
+class DeveloperPrivateInspectFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.inspect",
DEVELOPERPRIVATE_INSPECT)
@@ -183,7 +184,8 @@ class DeveloperPrivateInspectFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DeveloperPrivateAllowFileAccessFunction : public SyncExtensionFunction {
+class DeveloperPrivateAllowFileAccessFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.allowFileAccess",
DEVELOPERPRIVATE_ALLOWFILEACCESS);
@@ -195,7 +197,8 @@ class DeveloperPrivateAllowFileAccessFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DeveloperPrivateAllowIncognitoFunction : public SyncExtensionFunction {
+class DeveloperPrivateAllowIncognitoFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.allowIncognito",
DEVELOPERPRIVATE_ALLOWINCOGNITO);
@@ -207,7 +210,7 @@ class DeveloperPrivateAllowIncognitoFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DeveloperPrivateReloadFunction : public SyncExtensionFunction {
+class DeveloperPrivateReloadFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.reload",
DEVELOPERPRIVATE_RELOAD);
@@ -220,7 +223,7 @@ class DeveloperPrivateReloadFunction : public SyncExtensionFunction {
};
class DeveloperPrivateShowPermissionsDialogFunction
- : public SyncExtensionFunction,
+ : public ChromeSyncExtensionFunction,
public ExtensionInstallPrompt::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.showPermissionsDialog",
@@ -243,7 +246,7 @@ class DeveloperPrivateShowPermissionsDialogFunction
};
class DeveloperPrivateEnableFunction
- : public SyncExtensionFunction,
+ : public ChromeSyncExtensionFunction,
public base::SupportsWeakPtr<DeveloperPrivateEnableFunction> {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.enable",
@@ -264,7 +267,7 @@ class DeveloperPrivateEnableFunction
scoped_ptr<extensions::RequirementsChecker> requirements_checker_;
};
-class DeveloperPrivateChooseEntryFunction : public AsyncExtensionFunction,
+class DeveloperPrivateChooseEntryFunction : public ChromeAsyncExtensionFunction,
public EntryPickerClient {
protected:
virtual ~DeveloperPrivateChooseEntryFunction();
@@ -312,7 +315,7 @@ class DeveloperPrivateChoosePathFunction
};
class DeveloperPrivatePackDirectoryFunction
- : public AsyncExtensionFunction,
+ : public ChromeAsyncExtensionFunction,
public extensions::PackExtensionJob::Client {
public:
@@ -338,7 +341,7 @@ class DeveloperPrivatePackDirectoryFunction
std::string key_path_str_;
};
-class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction {
+class DeveloperPrivateGetStringsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.getStrings",
DEVELOPERPRIVATE_GETSTRINGS);
@@ -350,7 +353,8 @@ class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DeveloperPrivateIsProfileManagedFunction : public SyncExtensionFunction {
+class DeveloperPrivateIsProfileManagedFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.isProfileManaged",
DEVELOPERPRIVATE_ISPROFILEMANAGED);
@@ -363,7 +367,7 @@ class DeveloperPrivateIsProfileManagedFunction : public SyncExtensionFunction {
};
class DeveloperPrivateExportSyncfsFolderToLocalfsFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.exportSyncfsFolderToLocalfs",
DEVELOPERPRIVATE_LOADUNPACKEDCROS);
@@ -408,7 +412,8 @@ class DeveloperPrivateExportSyncfsFolderToLocalfsFunction
bool success_;
};
-class DeveloperPrivateLoadProjectFunction : public AsyncExtensionFunction {
+class DeveloperPrivateLoadProjectFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("developerPrivate.loadProject",
DEVELOPERPRIVATE_LOADPROJECT);
diff --git a/chrome/browser/extensions/api/dial/dial_api.cc b/chrome/browser/extensions/api/dial/dial_api.cc
index c018f31..303f8e7 100644
--- a/chrome/browser/extensions/api/dial/dial_api.cc
+++ b/chrome/browser/extensions/api/dial/dial_api.cc
@@ -153,8 +153,8 @@ DialDiscoverNowFunction::DialDiscoverNowFunction()
bool DialDiscoverNowFunction::Prepare() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(profile());
- dial_ = DialAPIFactory::GetForProfile(profile()).get();
+ DCHECK(GetProfile());
+ dial_ = DialAPIFactory::GetForProfile(GetProfile()).get();
return true;
}
diff --git a/chrome/browser/extensions/api/discovery/discovery_api.cc b/chrome/browser/extensions/api/discovery/discovery_api.cc
index 846e065..181ce56 100644
--- a/chrome/browser/extensions/api/discovery/discovery_api.cc
+++ b/chrome/browser/extensions/api/discovery/discovery_api.cc
@@ -40,7 +40,7 @@ bool DiscoverySuggestFunction::RunImpl() {
url_image = params->details.url_image.get();
extensions::SuggestedLinksRegistry* registry =
- extensions::SuggestedLinksRegistryFactory::GetForProfile(profile());
+ extensions::SuggestedLinksRegistryFactory::GetForProfile(GetProfile());
scoped_ptr<extensions::SuggestedLink> suggested_link(
new extensions::SuggestedLink(params->details.link_url,
params->details.link_text,
@@ -56,7 +56,7 @@ bool DiscoveryRemoveSuggestionFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
extensions::SuggestedLinksRegistry* registry =
- extensions::SuggestedLinksRegistryFactory::GetForProfile(profile());
+ extensions::SuggestedLinksRegistryFactory::GetForProfile(GetProfile());
registry->Remove(extension_id(), params->link_url);
return true;
@@ -64,7 +64,7 @@ bool DiscoveryRemoveSuggestionFunction::RunImpl() {
bool DiscoveryClearAllSuggestionsFunction::RunImpl() {
extensions::SuggestedLinksRegistry* registry =
- extensions::SuggestedLinksRegistryFactory::GetForProfile(profile());
+ extensions::SuggestedLinksRegistryFactory::GetForProfile(GetProfile());
registry->ClearAll(extension_id());
return true;
diff --git a/chrome/browser/extensions/api/discovery/discovery_api.h b/chrome/browser/extensions/api/discovery/discovery_api.h
index 9336761..bc20095 100644
--- a/chrome/browser/extensions/api/discovery/discovery_api.h
+++ b/chrome/browser/extensions/api/discovery/discovery_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_DISCOVERY_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_DISCOVERY_DISCOVERY_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
-class DiscoverySuggestFunction : public SyncExtensionFunction {
+class DiscoverySuggestFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.discovery.suggest",
EXPERIMENTAL_DISCOVERY_SUGGEST)
@@ -19,7 +19,7 @@ class DiscoverySuggestFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DiscoveryRemoveSuggestionFunction : public SyncExtensionFunction {
+class DiscoveryRemoveSuggestionFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.discovery.removeSuggestion",
EXPERIMENTAL_DISCOVERY_REMOVESUGGESTION)
@@ -29,7 +29,8 @@ class DiscoveryRemoveSuggestionFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class DiscoveryClearAllSuggestionsFunction : public SyncExtensionFunction {
+class DiscoveryClearAllSuggestionsFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.discovery.clearAllSuggestions",
EXPERIMENTAL_DISCOVERY_CLEARALLSUGGESTIONS)
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index f172419..4544f58 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -967,9 +967,9 @@ bool DownloadsDownloadFunction::RunImpl() {
if (Fault(!download_url.is_valid(), errors::kInvalidURL, &error_))
return false;
- Profile* current_profile = profile();
- if (include_incognito() && profile()->HasOffTheRecordProfile())
- current_profile = profile()->GetOffTheRecordProfile();
+ Profile* current_profile = GetProfile();
+ if (include_incognito() && GetProfile()->HasOffTheRecordProfile())
+ current_profile = GetProfile()->GetOffTheRecordProfile();
scoped_ptr<content::DownloadUrlParameters> download_params(
new content::DownloadUrlParameters(
@@ -1077,7 +1077,7 @@ bool DownloadsSearchFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadManager* manager = NULL;
DownloadManager* incognito_manager = NULL;
- GetManagers(profile(), include_incognito(), &manager, &incognito_manager);
+ GetManagers(GetProfile(), include_incognito(), &manager, &incognito_manager);
ManagerDestructionObserver::CheckForHistoryFilesRemoval(manager);
ManagerDestructionObserver::CheckForHistoryFilesRemoval(incognito_manager);
DownloadQuery::DownloadVector results;
@@ -1096,9 +1096,10 @@ bool DownloadsSearchFunction::RunImpl() {
uint32 download_id = download_item->GetId();
bool off_record = ((incognito_manager != NULL) &&
(incognito_manager->GetDownload(download_id) != NULL));
- scoped_ptr<base::DictionaryValue> json_item(DownloadItemToJSON(
- *it, off_record ? profile()->GetOffTheRecordProfile()
- : profile()->GetOriginalProfile()));
+ scoped_ptr<base::DictionaryValue> json_item(
+ DownloadItemToJSON(*it,
+ off_record ? GetProfile()->GetOffTheRecordProfile()
+ : GetProfile()->GetOriginalProfile()));
json_results->Append(json_item.release());
}
SetResult(json_results);
@@ -1114,8 +1115,8 @@ bool DownloadsPauseFunction::RunImpl() {
scoped_ptr<downloads::Pause::Params> params(
downloads::Pause::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (InvalidId(download_item, &error_) ||
Fault(download_item->GetState() != DownloadItem::IN_PROGRESS,
errors::kNotInProgress, &error_))
@@ -1135,8 +1136,8 @@ bool DownloadsResumeFunction::RunImpl() {
scoped_ptr<downloads::Resume::Params> params(
downloads::Resume::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (InvalidId(download_item, &error_) ||
Fault(download_item->IsPaused() && !download_item->CanResume(),
errors::kNotResumable, &error_))
@@ -1156,8 +1157,8 @@ bool DownloadsCancelFunction::RunImpl() {
scoped_ptr<downloads::Resume::Params> params(
downloads::Resume::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (download_item &&
(download_item->GetState() == DownloadItem::IN_PROGRESS))
download_item->Cancel(true);
@@ -1177,7 +1178,7 @@ bool DownloadsEraseFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
DownloadManager* manager = NULL;
DownloadManager* incognito_manager = NULL;
- GetManagers(profile(), include_incognito(), &manager, &incognito_manager);
+ GetManagers(GetProfile(), include_incognito(), &manager, &incognito_manager);
DownloadQuery::DownloadVector results;
RunDownloadQuery(params->query,
manager,
@@ -1211,8 +1212,8 @@ bool DownloadsRemoveFileFunction::RunImpl() {
scoped_ptr<downloads::RemoveFile::Params> params(
downloads::RemoveFile::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (InvalidId(download_item, &error_) ||
Fault((download_item->GetState() != DownloadItem::COMPLETE),
errors::kNotComplete, &error_) ||
@@ -1260,8 +1261,8 @@ bool DownloadsAcceptDangerFunction::RunImpl() {
}
void DownloadsAcceptDangerFunction::PromptOrWait(int download_id, int retries) {
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), download_id);
content::WebContents* web_contents =
dispatcher()->delegate()->GetVisibleWebContents();
if (InvalidId(download_item, &error_) ||
@@ -1305,8 +1306,8 @@ void DownloadsAcceptDangerFunction::PromptOrWait(int download_id, int retries) {
void DownloadsAcceptDangerFunction::DangerPromptCallback(
int download_id, DownloadDangerPrompt::Action action) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), download_id);
if (InvalidId(download_item, &error_) ||
Fault(download_item->GetState() != DownloadItem::IN_PROGRESS,
errors::kNotInProgress, &error_))
@@ -1332,8 +1333,8 @@ bool DownloadsShowFunction::RunImpl() {
scoped_ptr<downloads::Show::Params> params(
downloads::Show::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (InvalidId(download_item, &error_))
return false;
download_item->ShowDownloadInShell();
@@ -1348,7 +1349,7 @@ DownloadsShowDefaultFolderFunction::~DownloadsShowDefaultFolderFunction() {}
bool DownloadsShowDefaultFolderFunction::RunImpl() {
DownloadManager* manager = NULL;
DownloadManager* incognito_manager = NULL;
- GetManagers(profile(), include_incognito(), &manager, &incognito_manager);
+ GetManagers(GetProfile(), include_incognito(), &manager, &incognito_manager);
platform_util::OpenItem(DownloadPrefs::FromDownloadManager(
manager)->DownloadPath());
RecordApiFunctions(DOWNLOADS_FUNCTION_SHOW_DEFAULT_FOLDER);
@@ -1363,8 +1364,8 @@ bool DownloadsOpenFunction::RunImpl() {
scoped_ptr<downloads::Open::Params> params(
downloads::Open::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (InvalidId(download_item, &error_) ||
Fault(download_item->GetState() != DownloadItem::COMPLETE,
errors::kNotComplete, &error_) ||
@@ -1385,8 +1386,8 @@ bool DownloadsDragFunction::RunImpl() {
scoped_ptr<downloads::Drag::Params> params(
downloads::Drag::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
content::WebContents* web_contents =
dispatcher()->delegate()->GetVisibleWebContents();
if (InvalidId(download_item, &error_) ||
@@ -1422,7 +1423,7 @@ bool DownloadsSetShelfEnabledFunction::RunImpl() {
RecordApiFunctions(DOWNLOADS_FUNCTION_SET_SHELF_ENABLED);
DownloadManager* manager = NULL;
DownloadManager* incognito_manager = NULL;
- GetManagers(profile(), include_incognito(), &manager, &incognito_manager);
+ GetManagers(GetProfile(), include_incognito(), &manager, &incognito_manager);
DownloadService* service = NULL;
DownloadService* incognito_service = NULL;
if (manager) {
@@ -1484,8 +1485,8 @@ bool DownloadsGetFileIconFunction::RunImpl() {
int icon_size = kDefaultIconSize;
if (options && options->size.get())
icon_size = *options->size.get();
- DownloadItem* download_item = GetDownload(
- profile(), include_incognito(), params->download_id);
+ DownloadItem* download_item =
+ GetDownload(GetProfile(), include_incognito(), params->download_id);
if (InvalidId(download_item, &error_) ||
Fault(download_item->GetTargetFilePath().empty(),
errors::kEmptyFile, &error_))
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
index 6dce424..5542058 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -15,8 +15,8 @@
#include "chrome/browser/download/all_download_item_notifier.h"
#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/browser/download/download_path_reservation_tracker.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_warning_set.h"
#include "chrome/common/extensions/api/downloads.h"
#include "content/public/browser/download_item.h"
@@ -85,7 +85,7 @@ class DownloadedByExtension : public base::SupportsUserData::Data {
DISALLOW_COPY_AND_ASSIGN(DownloadedByExtension);
};
-class DownloadsDownloadFunction : public AsyncExtensionFunction {
+class DownloadsDownloadFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.download", DOWNLOADS_DOWNLOAD)
DownloadsDownloadFunction();
@@ -105,7 +105,7 @@ class DownloadsDownloadFunction : public AsyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsDownloadFunction);
};
-class DownloadsSearchFunction : public SyncExtensionFunction {
+class DownloadsSearchFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.search", DOWNLOADS_SEARCH)
DownloadsSearchFunction();
@@ -118,7 +118,7 @@ class DownloadsSearchFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction);
};
-class DownloadsPauseFunction : public SyncExtensionFunction {
+class DownloadsPauseFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.pause", DOWNLOADS_PAUSE)
DownloadsPauseFunction();
@@ -131,7 +131,7 @@ class DownloadsPauseFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsPauseFunction);
};
-class DownloadsResumeFunction : public SyncExtensionFunction {
+class DownloadsResumeFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.resume", DOWNLOADS_RESUME)
DownloadsResumeFunction();
@@ -144,7 +144,7 @@ class DownloadsResumeFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsResumeFunction);
};
-class DownloadsCancelFunction : public SyncExtensionFunction {
+class DownloadsCancelFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.cancel", DOWNLOADS_CANCEL)
DownloadsCancelFunction();
@@ -157,7 +157,7 @@ class DownloadsCancelFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsCancelFunction);
};
-class DownloadsEraseFunction : public SyncExtensionFunction {
+class DownloadsEraseFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.erase", DOWNLOADS_ERASE)
DownloadsEraseFunction();
@@ -170,7 +170,7 @@ class DownloadsEraseFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction);
};
-class DownloadsRemoveFileFunction : public AsyncExtensionFunction,
+class DownloadsRemoveFileFunction : public ChromeAsyncExtensionFunction,
public content::DownloadItem::Observer {
public:
DECLARE_EXTENSION_FUNCTION("downloads.removeFile", DOWNLOADS_REMOVEFILE)
@@ -189,7 +189,7 @@ class DownloadsRemoveFileFunction : public AsyncExtensionFunction,
DISALLOW_COPY_AND_ASSIGN(DownloadsRemoveFileFunction);
};
-class DownloadsAcceptDangerFunction : public AsyncExtensionFunction {
+class DownloadsAcceptDangerFunction : public ChromeAsyncExtensionFunction {
public:
typedef base::Callback<void(DownloadDangerPrompt*)> OnPromptCreatedCallback;
static void OnPromptCreatedForTesting(
@@ -213,7 +213,7 @@ class DownloadsAcceptDangerFunction : public AsyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsAcceptDangerFunction);
};
-class DownloadsShowFunction : public AsyncExtensionFunction {
+class DownloadsShowFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.show", DOWNLOADS_SHOW)
DownloadsShowFunction();
@@ -226,7 +226,7 @@ class DownloadsShowFunction : public AsyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsShowFunction);
};
-class DownloadsShowDefaultFolderFunction : public AsyncExtensionFunction {
+class DownloadsShowDefaultFolderFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"downloads.showDefaultFolder", DOWNLOADS_SHOWDEFAULTFOLDER)
@@ -240,7 +240,7 @@ class DownloadsShowDefaultFolderFunction : public AsyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsShowDefaultFolderFunction);
};
-class DownloadsOpenFunction : public SyncExtensionFunction {
+class DownloadsOpenFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.open", DOWNLOADS_OPEN)
DownloadsOpenFunction();
@@ -253,7 +253,7 @@ class DownloadsOpenFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsOpenFunction);
};
-class DownloadsSetShelfEnabledFunction : public SyncExtensionFunction {
+class DownloadsSetShelfEnabledFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.setShelfEnabled",
DOWNLOADS_SETSHELFENABLED)
@@ -267,7 +267,7 @@ class DownloadsSetShelfEnabledFunction : public SyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsSetShelfEnabledFunction);
};
-class DownloadsDragFunction : public AsyncExtensionFunction {
+class DownloadsDragFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.drag", DOWNLOADS_DRAG)
DownloadsDragFunction();
@@ -280,7 +280,7 @@ class DownloadsDragFunction : public AsyncExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(DownloadsDragFunction);
};
-class DownloadsGetFileIconFunction : public AsyncExtensionFunction {
+class DownloadsGetFileIconFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloads.getFileIcon", DOWNLOADS_GETFILEICON)
DownloadsGetFileIconFunction();
diff --git a/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc b/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc
index a362f9d..cb12918 100644
--- a/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc
+++ b/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc
@@ -26,13 +26,13 @@ bool DownloadsInternalDetermineFilenameFunction::RunImpl() {
base::FilePath::StringType filename;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filename));
return ExtensionDownloadsEventRouter::DetermineFilename(
- profile(),
+ GetProfile(),
include_incognito(),
GetExtension()->id(),
params->download_id,
base::FilePath(filename),
extensions::api::downloads::ParseFilenameConflictAction(
- params->conflict_action),
+ params->conflict_action),
&error_);
}
diff --git a/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h b/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h
index 3459fbe..a88364e 100644
--- a/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h
+++ b/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_INTERNAL_DOWNLOADS_INTERNAL_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_INTERNAL_DOWNLOADS_INTERNAL_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
class DownloadsInternalDetermineFilenameFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("downloadsInternal.determineFilename",
DOWNLOADSINTERNAL_DETERMINEFILENAME);
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
index b1078c6..58258ce 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
@@ -113,7 +113,7 @@ bool EPKPChallengeKeyBase::IsEnterpriseDevice() const {
bool EPKPChallengeKeyBase::IsExtensionWhitelisted() const {
const base::ListValue* list =
- profile()->GetPrefs()->GetList(prefs::kAttestationExtensionWhitelist);
+ GetProfile()->GetPrefs()->GetList(prefs::kAttestationExtensionWhitelist);
StringValue value(extension_->id());
return list->Find(value) != list->end();
}
@@ -133,7 +133,7 @@ std::string EPKPChallengeKeyBase::GetEnterpriseDomain() const {
std::string EPKPChallengeKeyBase::GetUserEmail() const {
SigninManagerBase* signin_manager =
- SigninManagerFactory::GetForProfile(profile());
+ SigninManagerFactory::GetForProfile(GetProfile());
if (!signin_manager)
return std::string();
@@ -521,7 +521,7 @@ void EPKPChallengeUserKey::RegisterKeyCallback(
}
bool EPKPChallengeUserKey::IsRemoteAttestationEnabledForUser() const {
- return profile()->GetPrefs()->GetBoolean(prefs::kAttestationEnabled);
+ return GetProfile()->GetPrefs()->GetBoolean(prefs::kAttestationEnabled);
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
index 80e6b9f..6c82979 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
+++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
@@ -10,7 +10,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/enterprise_platform_keys_private.h"
#include "chromeos/attestation/attestation_constants.h"
#include "chromeos/attestation/attestation_flow.h"
@@ -38,7 +38,7 @@ class PrefRegistrySyncable;
namespace extensions {
-class EPKPChallengeKeyBase : public AsyncExtensionFunction {
+class EPKPChallengeKeyBase : public ChromeAsyncExtensionFunction {
public:
static const char kChallengeBadBase64Error[];
static const char kDevicePolicyDisabledError[];
diff --git a/chrome/browser/extensions/api/execute_code_function.h b/chrome/browser/extensions/api/execute_code_function.h
index 6d2d420..bd70ff9 100644
--- a/chrome/browser/extensions/api/execute_code_function.h
+++ b/chrome/browser/extensions/api/execute_code_function.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_EXECUTE_CODE_FUNCTION_H_
#define CHROME_BROWSER_EXTENSIONS_API_EXECUTE_CODE_FUNCTION_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/script_executor.h"
#include "chrome/common/extensions/api/tabs.h"
@@ -14,7 +14,7 @@ namespace extensions {
// Base class for javascript code injection.
// This is used by both chrome.webview.executeScript and
// chrome.tabs.executeScript.
-class ExecuteCodeFunction : public AsyncExtensionFunction {
+class ExecuteCodeFunction : public ChromeAsyncExtensionFunction {
public:
ExecuteCodeFunction();
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
index 1024b83..470af85 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc
@@ -494,7 +494,7 @@ ExtensionActionFunction::~ExtensionActionFunction() {
}
bool ExtensionActionFunction::RunImpl() {
- ExtensionActionManager* manager = ExtensionActionManager::Get(profile_);
+ ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile());
const Extension* extension = GetExtension();
if (StartsWithASCII(name(), "scriptBadge.", false)) {
extension_action_ = manager->GetScriptBadge(*extension);
@@ -519,8 +519,13 @@ bool ExtensionActionFunction::RunImpl() {
// Find the WebContents that contains this tab id if one is required.
if (tab_id_ != ExtensionAction::kDefaultTabId) {
- ExtensionTabUtil::GetTabById(
- tab_id_, profile(), include_incognito(), NULL, NULL, &contents_, NULL);
+ ExtensionTabUtil::GetTabById(tab_id_,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ NULL,
+ &contents_,
+ NULL);
if (!contents_) {
error_ = ErrorUtils::FormatErrorMessage(
kNoTabError, base::IntToString(tab_id_));
@@ -587,10 +592,10 @@ void ExtensionActionFunction::NotifyChange() {
switch (extension_action_->action_type()) {
case ActionInfo::TYPE_BROWSER:
case ActionInfo::TYPE_PAGE:
- if (ExtensionActionManager::Get(profile_)
+ if (ExtensionActionManager::Get(GetProfile())
->GetBrowserAction(*extension_.get())) {
NotifyBrowserActionChange();
- } else if (ExtensionActionManager::Get(profile_)
+ } else if (ExtensionActionManager::Get(GetProfile())
->GetPageAction(*extension_.get())) {
NotifyLocationBarChange();
}
@@ -609,7 +614,7 @@ void ExtensionActionFunction::NotifyBrowserActionChange() {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
content::Source<ExtensionAction>(extension_action_),
- content::Details<Profile>(profile()));
+ content::Details<Profile>(GetProfile()));
}
void ExtensionActionFunction::NotifyLocationBarChange() {
@@ -620,7 +625,7 @@ void ExtensionActionFunction::NotifyLocationBarChange() {
void ExtensionActionFunction::NotifySystemIndicatorChange() {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED,
- content::Source<Profile>(profile()),
+ content::Source<Profile>(GetProfile()),
content::Details<ExtensionAction>(extension_action_));
}
@@ -814,8 +819,9 @@ BrowserActionOpenPopupFunction::BrowserActionOpenPopupFunction()
}
bool BrowserActionOpenPopupFunction::RunImpl() {
- ExtensionToolbarModel* model = extensions::ExtensionSystem::Get(profile_)->
- extension_service()->toolbar_model();
+ ExtensionToolbarModel* model = extensions::ExtensionSystem::Get(GetProfile())
+ ->extension_service()
+ ->toolbar_model();
if (!model) {
error_ = kInternalError;
return false;
@@ -826,8 +832,9 @@ bool BrowserActionOpenPopupFunction::RunImpl() {
return false;
}
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
- content::Source<Profile>(profile_));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
+ content::Source<Profile>(GetProfile()));
// Set a timeout for waiting for the notification that the popup is loaded.
// Waiting is required so that the popup view can be retrieved by the custom
@@ -911,9 +918,8 @@ bool PageActionsFunction::SetPageActionEnabled(bool enable) {
page_actions_keys::kTitleKey, &title));
}
- ExtensionAction* page_action =
- extensions::ExtensionActionManager::Get(profile())->
- GetPageAction(*GetExtension());
+ ExtensionAction* page_action = extensions::ExtensionActionManager::Get(
+ GetProfile())->GetPageAction(*GetExtension());
if (!page_action) {
error_ = extensions::kNoPageActionError;
return false;
@@ -922,7 +928,7 @@ bool PageActionsFunction::SetPageActionEnabled(bool enable) {
// Find the WebContents that contains this tab id.
WebContents* contents = NULL;
bool result = ExtensionTabUtil::GetTabById(
- tab_id, profile(), include_incognito(), NULL, NULL, &contents, NULL);
+ tab_id, GetProfile(), include_incognito(), NULL, NULL, &contents, NULL);
if (!result || !contents) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::kNoTabError, base::IntToString(tab_id));
diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.h b/chrome/browser/extensions/api/extension_action/extension_action_api.h
index 8471ae3..a8e92dd 100644
--- a/chrome/browser/extensions/api/extension_action/extension_action_api.h
+++ b/chrome/browser/extensions/api/extension_action/extension_action_api.h
@@ -9,8 +9,8 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_action.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -120,7 +120,7 @@ class ExtensionActionStorageManager
// have required tabIds while browserAction's are optional, they have different
// internal browser notification requirements, and not all functions are defined
// for all APIs).
-class ExtensionActionFunction : public SyncExtensionFunction {
+class ExtensionActionFunction : public ChromeSyncExtensionFunction {
public:
static bool ParseCSSColorString(const std::string& color_string,
SkColor* result);
@@ -343,7 +343,7 @@ class BrowserActionDisableFunction : public ExtensionActionHideFunction {
virtual ~BrowserActionDisableFunction() {}
};
-class BrowserActionOpenPopupFunction : public UIThreadExtensionFunction,
+class BrowserActionOpenPopupFunction : public ChromeAsyncExtensionFunction,
public content::NotificationObserver {
public:
DECLARE_EXTENSION_FUNCTION("browserAction.openPopup",
@@ -467,7 +467,7 @@ class PageActionGetPopupFunction
};
// Base class for deprecated page actions APIs
-class PageActionsFunction : public SyncExtensionFunction {
+class PageActionsFunction : public ChromeSyncExtensionFunction {
protected:
PageActionsFunction();
virtual ~PageActionsFunction();
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
index 322530d..ce46532 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
+++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc
@@ -131,9 +131,9 @@ bool FeedbackPrivateGetStringsFunction::RunImpl() {
bool FeedbackPrivateGetUserEmailFunction::RunImpl() {
// TODO(rkc): Remove logging once crbug.com/284662 is closed.
LOG(WARNING) << "FEEDBACK_DEBUG: User e-mail requested.";
- FeedbackService* service =
- FeedbackPrivateAPI::GetFactoryInstance()->GetForProfile(
- profile())->GetService();
+ FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->GetService();
DCHECK(service);
SetResult(new base::StringValue(service->GetUserEmail()));
return true;
@@ -142,9 +142,9 @@ bool FeedbackPrivateGetUserEmailFunction::RunImpl() {
bool FeedbackPrivateGetSystemInformationFunction::RunImpl() {
// TODO(rkc): Remove logging once crbug.com/284662 is closed.
LOG(WARNING) << "FEEDBACK_DEBUG: System information requested.";
- FeedbackService* service =
- FeedbackPrivateAPI::GetFactoryInstance()->GetForProfile(
- profile())->GetService();
+ FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->GetService();
DCHECK(service);
service->GetSystemInformation(
base::Bind(
@@ -178,7 +178,7 @@ bool FeedbackPrivateSendFeedbackFunction::RunImpl() {
// Populate feedback data.
scoped_refptr<FeedbackData> feedback_data(new FeedbackData());
- feedback_data->set_profile(profile_);
+ feedback_data->set_profile(GetProfile());
feedback_data->set_description(feedback_info.description);
if (feedback_info.category_tag.get())
@@ -211,13 +211,14 @@ bool FeedbackPrivateSendFeedbackFunction::RunImpl() {
}
feedback_data->SetAndCompressSystemInfo(sys_logs.Pass());
- FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance()->
- GetForProfile(profile())->GetService();
+ FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->GetService();
DCHECK(service);
- service->SendFeedback(profile(),
- feedback_data, base::Bind(
- &FeedbackPrivateSendFeedbackFunction::OnCompleted,
- this));
+ service->SendFeedback(
+ GetProfile(),
+ feedback_data,
+ base::Bind(&FeedbackPrivateSendFeedbackFunction::OnCompleted, this));
return true;
}
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.h b/chrome/browser/extensions/api/feedback_private/feedback_private_api.h
index a4ac045..e11808e 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.h
+++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/feedback_private.h"
#include "ui/gfx/rect.h"
@@ -46,7 +46,7 @@ class FeedbackPrivateAPI : public ProfileKeyedAPI {
};
// Feedback strings.
-class FeedbackPrivateGetStringsFunction : public SyncExtensionFunction {
+class FeedbackPrivateGetStringsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getStrings",
FEEDBACKPRIVATE_GETSTRINGS)
@@ -66,7 +66,7 @@ class FeedbackPrivateGetStringsFunction : public SyncExtensionFunction {
static base::Closure* test_callback_;
};
-class FeedbackPrivateGetUserEmailFunction : public SyncExtensionFunction {
+class FeedbackPrivateGetUserEmailFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getUserEmail",
FEEDBACKPRIVATE_GETUSEREMAIL);
@@ -77,7 +77,7 @@ class FeedbackPrivateGetUserEmailFunction : public SyncExtensionFunction {
};
class FeedbackPrivateGetSystemInformationFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getSystemInformation",
FEEDBACKPRIVATE_GETSYSTEMINFORMATION);
@@ -91,7 +91,8 @@ class FeedbackPrivateGetSystemInformationFunction
const std::vector<linked_ptr<SystemInformation> >& sys_info);
};
-class FeedbackPrivateSendFeedbackFunction : public AsyncExtensionFunction {
+class FeedbackPrivateSendFeedbackFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("feedbackPrivate.sendFeedback",
FEEDBACKPRIVATE_SENDFEEDBACK);
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 93a2a2f..3397850 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -329,7 +329,7 @@ void FileSystemEntryFunction::CheckWritableFiles(
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
app_file_handler_util::CheckWritableFiles(
paths,
- profile_,
+ GetProfile(),
is_directory_,
base::Bind(&FileSystemEntryFunction::RegisterFileSystemsAndSendResponse,
this,
@@ -366,7 +366,7 @@ void FileSystemEntryFunction::AddEntryToResponse(
DCHECK(response_);
extensions::app_file_handler_util::GrantedFileEntry file_entry =
extensions::app_file_handler_util::CreateFileEntry(
- profile(),
+ GetProfile(),
GetExtension(),
render_view_host_->GetProcess()->GetID(),
path,
@@ -587,7 +587,7 @@ void FileSystemChooseEntryFunction::ShowPicker(
content::WebContents* web_contents = NULL;
if (extension_->is_platform_app()) {
apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(profile());
+ apps::ShellWindowRegistry::Get(GetProfile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
@@ -697,14 +697,15 @@ void FileSystemChooseEntryFunction::FilesSelected(
} else {
last_choose_directory = paths[0].DirName();
}
- file_system_api::SetLastChooseEntryDirectory(ExtensionPrefs::Get(profile()),
- GetExtension()->id(),
- last_choose_directory);
+ file_system_api::SetLastChooseEntryDirectory(
+ ExtensionPrefs::Get(GetProfile()),
+ GetExtension()->id(),
+ last_choose_directory);
if (is_directory_) {
// Get the WebContents for the app window to be the parent window of the
// confirmation dialog if necessary.
apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(profile());
+ apps::ShellWindowRegistry::Get(GetProfile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
@@ -915,9 +916,7 @@ bool FileSystemChooseEntryFunction::RunImpl() {
base::FilePath previous_path;
file_system_api::GetLastChooseEntryDirectory(
- ExtensionPrefs::Get(profile()),
- GetExtension()->id(),
- &previous_path);
+ ExtensionPrefs::Get(GetProfile()), GetExtension()->id(), &previous_path);
content::BrowserThread::PostTaskAndReply(
content::BrowserThread::FILE,
@@ -934,7 +933,7 @@ bool FileSystemChooseEntryFunction::RunImpl() {
bool FileSystemRetainEntryFunction::RunImpl() {
std::string entry_id;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &entry_id));
- SavedFilesService* saved_files_service = SavedFilesService::Get(profile());
+ SavedFilesService* saved_files_service = SavedFilesService::Get(GetProfile());
// Add the file to the retain list if it is not already on there.
if (!saved_files_service->IsRegistered(extension_->id(), entry_id)) {
std::string filesystem_name;
@@ -966,7 +965,7 @@ bool FileSystemRetainEntryFunction::RunImpl() {
void FileSystemRetainEntryFunction::RetainFileEntry(
const std::string& entry_id) {
- SavedFilesService* saved_files_service = SavedFilesService::Get(profile());
+ SavedFilesService* saved_files_service = SavedFilesService::Get(GetProfile());
saved_files_service->RegisterFileEntry(
extension_->id(), entry_id, path_, is_directory_);
saved_files_service->EnqueueFileEntry(extension_->id(), entry_id);
@@ -981,7 +980,7 @@ bool FileSystemIsRestorableFunction::RunImpl() {
std::string entry_id;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &entry_id));
SetResult(new base::FundamentalValue(SavedFilesService::Get(
- profile())->IsRegistered(extension_->id(), entry_id)));
+ GetProfile())->IsRegistered(extension_->id(), entry_id)));
return true;
}
@@ -991,14 +990,14 @@ bool FileSystemRestoreEntryFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &entry_id));
EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &needs_new_entry));
const SavedFileEntry* file_entry = SavedFilesService::Get(
- profile())->GetFileEntry(extension_->id(), entry_id);
+ GetProfile())->GetFileEntry(extension_->id(), entry_id);
if (!file_entry) {
error_ = kUnknownIdError;
return false;
}
- SavedFilesService::Get(profile())->EnqueueFileEntry(
- extension_->id(), entry_id);
+ SavedFilesService::Get(GetProfile())
+ ->EnqueueFileEntry(extension_->id(), entry_id);
// Only create a new file entry if the renderer requests one.
// |needs_new_entry| will be false if the renderer already has an Entry for
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.h b/chrome/browser/extensions/api/file_system/file_system_api.h
index ce3ccea..52f516f 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.h
+++ b/chrome/browser/extensions/api/file_system/file_system_api.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/file_system.h"
#include "ui/shell_dialogs/select_file_dialog.h"
@@ -33,7 +33,7 @@ void SetLastChooseEntryDirectory(ExtensionPrefs* prefs,
} // namespace file_system_api
-class FileSystemGetDisplayPathFunction : public SyncExtensionFunction {
+class FileSystemGetDisplayPathFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileSystem.getDisplayPath",
FILESYSTEM_GETDISPLAYPATH)
@@ -43,7 +43,7 @@ class FileSystemGetDisplayPathFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class FileSystemEntryFunction : public AsyncExtensionFunction {
+class FileSystemEntryFunction : public ChromeAsyncExtensionFunction {
protected:
FileSystemEntryFunction();
@@ -98,7 +98,7 @@ class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction {
base::FilePath path_;
};
-class FileSystemIsWritableEntryFunction : public SyncExtensionFunction {
+class FileSystemIsWritableEntryFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry",
FILESYSTEM_ISWRITABLEENTRY)
@@ -170,7 +170,7 @@ class FileSystemChooseEntryFunction : public FileSystemEntryFunction {
base::FilePath initial_path_;
};
-class FileSystemRetainEntryFunction : public AsyncExtensionFunction {
+class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY)
@@ -192,7 +192,7 @@ class FileSystemRetainEntryFunction : public AsyncExtensionFunction {
base::FilePath path_;
};
-class FileSystemIsRestorableFunction : public SyncExtensionFunction {
+class FileSystemIsRestorableFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE)
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
index 2152270..8692336 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
@@ -220,7 +220,7 @@ ProfileKeyedAPIFactory<FontSettingsAPI>* FontSettingsAPI::GetFactoryInstance() {
}
bool FontSettingsClearFontFunction::RunImpl() {
- if (profile_->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = kSetFromIncognitoError;
return false;
}
@@ -234,9 +234,9 @@ bool FontSettingsClearFontFunction::RunImpl() {
// Ensure |pref_path| really is for a registered per-script font pref.
EXTENSION_FUNCTION_VALIDATE(
- profile_->GetPrefs()->FindPreference(pref_path.c_str()));
+ GetProfile()->GetPrefs()->FindPreference(pref_path.c_str()));
- PreferenceAPI::Get(profile_)->RemoveExtensionControlledPref(
+ PreferenceAPI::Get(GetProfile())->RemoveExtensionControlledPref(
extension_id(), pref_path.c_str(), kExtensionPrefsScopeRegular);
return true;
}
@@ -249,7 +249,7 @@ bool FontSettingsGetFontFunction::RunImpl() {
std::string pref_path = GetFontNamePrefPath(params->details.generic_family,
params->details.script);
- PrefService* prefs = profile_->GetPrefs();
+ PrefService* prefs = GetProfile()->GetPrefs();
const PrefService::Preference* pref =
prefs->FindPreference(pref_path.c_str());
@@ -262,10 +262,8 @@ bool FontSettingsGetFontFunction::RunImpl() {
// getting level of control.
const bool kIncognito = false;
std::string level_of_control =
- extensions::preference_helpers::GetLevelOfControl(profile_,
- extension_id(),
- pref_path,
- kIncognito);
+ extensions::preference_helpers::GetLevelOfControl(
+ GetProfile(), extension_id(), pref_path, kIncognito);
base::DictionaryValue* result = new base::DictionaryValue();
result->SetString(kFontIdKey, font_name);
@@ -275,7 +273,7 @@ bool FontSettingsGetFontFunction::RunImpl() {
}
bool FontSettingsSetFontFunction::RunImpl() {
- if (profile_->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = kSetFromIncognitoError;
return false;
}
@@ -289,9 +287,9 @@ bool FontSettingsSetFontFunction::RunImpl() {
// Ensure |pref_path| really is for a registered font pref.
EXTENSION_FUNCTION_VALIDATE(
- profile_->GetPrefs()->FindPreference(pref_path.c_str()));
+ GetProfile()->GetPrefs()->FindPreference(pref_path.c_str()));
- PreferenceAPI::Get(profile_)->SetExtensionControlledPref(
+ PreferenceAPI::Get(GetProfile())->SetExtensionControlledPref(
extension_id(),
pref_path.c_str(),
kExtensionPrefsScopeRegular,
@@ -345,18 +343,18 @@ bool FontSettingsGetFontListFunction::CopyFontsToResult(
}
bool ClearFontPrefExtensionFunction::RunImpl() {
- if (profile_->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = kSetFromIncognitoError;
return false;
}
- PreferenceAPI::Get(profile_)->RemoveExtensionControlledPref(
+ PreferenceAPI::Get(GetProfile())->RemoveExtensionControlledPref(
extension_id(), GetPrefName(), kExtensionPrefsScopeRegular);
return true;
}
bool GetFontPrefExtensionFunction::RunImpl() {
- PrefService* prefs = profile_->GetPrefs();
+ PrefService* prefs = GetProfile()->GetPrefs();
const PrefService::Preference* pref = prefs->FindPreference(GetPrefName());
EXTENSION_FUNCTION_VALIDATE(pref);
@@ -365,10 +363,8 @@ bool GetFontPrefExtensionFunction::RunImpl() {
const bool kIncognito = false;
std::string level_of_control =
- extensions::preference_helpers::GetLevelOfControl(profile_,
- extension_id(),
- GetPrefName(),
- kIncognito);
+ extensions::preference_helpers::GetLevelOfControl(
+ GetProfile(), extension_id(), GetPrefName(), kIncognito);
base::DictionaryValue* result = new base::DictionaryValue();
result->Set(GetKey(), pref->GetValue()->DeepCopy());
@@ -378,7 +374,7 @@ bool GetFontPrefExtensionFunction::RunImpl() {
}
bool SetFontPrefExtensionFunction::RunImpl() {
- if (profile_->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = kSetFromIncognitoError;
return false;
}
@@ -389,11 +385,11 @@ bool SetFontPrefExtensionFunction::RunImpl() {
Value* value;
EXTENSION_FUNCTION_VALIDATE(details->Get(GetKey(), &value));
- PreferenceAPI::Get(profile_)->SetExtensionControlledPref(
- extension_id(),
- GetPrefName(),
- kExtensionPrefsScopeRegular,
- value->DeepCopy());
+ PreferenceAPI::Get(GetProfile())
+ ->SetExtensionControlledPref(extension_id(),
+ GetPrefName(),
+ kExtensionPrefsScopeRegular,
+ value->DeepCopy());
return true;
}
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.h b/chrome/browser/extensions/api/font_settings/font_settings_api.h
index 1955467..497ee35 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.h
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h
@@ -14,8 +14,8 @@
#include "base/prefs/pref_change_registrar.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
class Profile;
@@ -91,7 +91,7 @@ class FontSettingsAPI : public ProfileKeyedAPI {
};
// fontSettings.clearFont API function.
-class FontSettingsClearFontFunction : public SyncExtensionFunction {
+class FontSettingsClearFontFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fontSettings.clearFont", FONTSETTINGS_CLEARFONT)
@@ -105,7 +105,7 @@ class FontSettingsClearFontFunction : public SyncExtensionFunction {
};
// fontSettings.getFont API function.
-class FontSettingsGetFontFunction : public SyncExtensionFunction {
+class FontSettingsGetFontFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fontSettings.getFont", FONTSETTINGS_GETFONT)
@@ -117,7 +117,7 @@ class FontSettingsGetFontFunction : public SyncExtensionFunction {
};
// fontSettings.setFont API function.
-class FontSettingsSetFontFunction : public SyncExtensionFunction {
+class FontSettingsSetFontFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fontSettings.setFont", FONTSETTINGS_SETFONT)
@@ -129,7 +129,7 @@ class FontSettingsSetFontFunction : public SyncExtensionFunction {
};
// fontSettings.getFontList API function.
-class FontSettingsGetFontListFunction : public AsyncExtensionFunction {
+class FontSettingsGetFontListFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fontSettings.getFontList",
FONTSETTINGS_GETFONTLIST)
@@ -146,7 +146,7 @@ class FontSettingsGetFontListFunction : public AsyncExtensionFunction {
};
// Base class for extension API functions that clear a browser font pref.
-class ClearFontPrefExtensionFunction : public SyncExtensionFunction {
+class ClearFontPrefExtensionFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~ClearFontPrefExtensionFunction() {}
@@ -159,7 +159,7 @@ class ClearFontPrefExtensionFunction : public SyncExtensionFunction {
};
// Base class for extension API functions that get a browser font pref.
-class GetFontPrefExtensionFunction : public SyncExtensionFunction {
+class GetFontPrefExtensionFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~GetFontPrefExtensionFunction() {}
@@ -176,7 +176,7 @@ class GetFontPrefExtensionFunction : public SyncExtensionFunction {
};
// Base class for extension API functions that set a browser font pref.
-class SetFontPrefExtensionFunction : public SyncExtensionFunction {
+class SetFontPrefExtensionFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~SetFontPrefExtensionFunction() {}
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc
index d6b08ca..cb75c96 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -253,7 +253,7 @@ bool HistoryFunction::ValidateUrl(const std::string& url_string, GURL* url) {
}
bool HistoryFunction::VerifyDeleteAllowed() {
- PrefService* prefs = profile()->GetPrefs();
+ PrefService* prefs = GetProfile()->GetPrefs();
if (!prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory)) {
error_ = kDeleteProhibitedError;
return false;
@@ -313,8 +313,8 @@ bool HistoryGetMostVisitedFunction::RunAsyncImpl() {
int max_results = 100;
if (params->details.max_results.get())
max_results = *params->details.max_results;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->QueryFilteredURLs(max_results, filter, false, &cancelable_consumer_,
base::Bind(&HistoryGetMostVisitedFunction::QueryComplete,
base::Unretained(this)));
@@ -344,9 +344,8 @@ bool HistoryGetVisitsFunction::RunAsyncImpl() {
if (!ValidateUrl(params->details.url, &url))
return false;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(),
- Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->QueryURL(url,
true, // Retrieve full history of a URL.
&cancelable_consumer_,
@@ -392,9 +391,8 @@ bool HistorySearchFunction::RunAsyncImpl() {
if (params->query.max_results.get())
options.max_count = *params->query.max_results;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(),
- Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->QueryHistory(search_text, options, &cancelable_consumer_,
base::Bind(&HistorySearchFunction::SearchComplete,
base::Unretained(this)));
@@ -427,9 +425,8 @@ bool HistoryAddUrlFunction::RunImpl() {
if (!ValidateUrl(params->details.url, &url))
return false;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(),
- Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->AddPage(url, base::Time::Now(), history::SOURCE_EXTENSION);
SendResponse(true);
@@ -447,9 +444,8 @@ bool HistoryDeleteUrlFunction::RunImpl() {
if (!ValidateUrl(params->details.url, &url))
return false;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(),
- Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->DeleteURL(url);
// Also clean out from the activity log. If the activity log testing flag is
@@ -457,7 +453,7 @@ bool HistoryDeleteUrlFunction::RunImpl() {
// extensions have been trying to clean from their logs.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExtensionActivityLogTesting)) {
- ActivityLog* activity_log = ActivityLog::GetInstance(profile_);
+ ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile());
DCHECK(activity_log);
activity_log->RemoveURL(url);
}
@@ -477,9 +473,8 @@ bool HistoryDeleteRangeFunction::RunAsyncImpl() {
base::Time end_time = GetTime(params->range.end_time);
std::set<GURL> restrict_urls;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(),
- Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->ExpireHistoryBetween(
restrict_urls,
start_time,
@@ -491,7 +486,7 @@ bool HistoryDeleteRangeFunction::RunAsyncImpl() {
// Also clean from the activity log unless in testing mode.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExtensionActivityLogTesting)) {
- ActivityLog* activity_log = ActivityLog::GetInstance(profile_);
+ ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile());
DCHECK(activity_log);
activity_log->RemoveURLs(restrict_urls);
}
@@ -508,9 +503,8 @@ bool HistoryDeleteAllFunction::RunAsyncImpl() {
return false;
std::set<GURL> restrict_urls;
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile(),
- Profile::EXPLICIT_ACCESS);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ GetProfile(), Profile::EXPLICIT_ACCESS);
hs->ExpireHistoryBetween(
restrict_urls,
base::Time(), // Unbounded beginning...
@@ -522,7 +516,7 @@ bool HistoryDeleteAllFunction::RunAsyncImpl() {
// Also clean from the activity log unless in testing mode.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExtensionActivityLogTesting)) {
- ActivityLog* activity_log = ActivityLog::GetInstance(profile_);
+ ActivityLog* activity_log = ActivityLog::GetInstance(GetProfile());
DCHECK(activity_log);
activity_log->RemoveURLs(restrict_urls);
}
diff --git a/chrome/browser/extensions/api/history/history_api.h b/chrome/browser/extensions/api/history/history_api.h
index 619aed7..2106949 100644
--- a/chrome/browser/extensions/api/history/history_api.h
+++ b/chrome/browser/extensions/api/history/history_api.h
@@ -11,8 +11,8 @@
#include "base/compiler_specific.h"
#include "base/memory/linked_ptr.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/common/cancelable_task_tracker.h"
@@ -88,7 +88,7 @@ template<>
void ProfileKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies();
// Base class for history function APIs.
-class HistoryFunction : public AsyncExtensionFunction {
+class HistoryFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~HistoryFunction() {}
virtual void Run() OVERRIDE;
diff --git a/chrome/browser/extensions/api/i18n/i18n_api.cc b/chrome/browser/extensions/api/i18n/i18n_api.cc
index dbf3b71..e2a4578 100644
--- a/chrome/browser/extensions/api/i18n/i18n_api.cc
+++ b/chrome/browser/extensions/api/i18n/i18n_api.cc
@@ -29,7 +29,7 @@ static const char kEmptyAcceptLanguagesError[] = "accept-languages is empty.";
bool I18nGetAcceptLanguagesFunction::RunImpl() {
std::string accept_languages =
- profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ GetProfile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
// Currently, there are 2 ways to set browser's accept-languages: through UI
// or directly modify the preference file. The accept-languages set through
// UI is guranteed to be valid, and the accept-languages string returned from
diff --git a/chrome/browser/extensions/api/i18n/i18n_api.h b/chrome/browser/extensions/api/i18n/i18n_api.h
index 5d8c12e..79b4992 100644
--- a/chrome/browser/extensions/api/i18n/i18n_api.h
+++ b/chrome/browser/extensions/api/i18n/i18n_api.h
@@ -6,13 +6,13 @@
#define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
class Profile;
namespace extensions {
-class I18nGetAcceptLanguagesFunction : public SyncExtensionFunction {
+class I18nGetAcceptLanguagesFunction : public ChromeSyncExtensionFunction {
virtual ~I18nGetAcceptLanguagesFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES)
diff --git a/chrome/browser/extensions/api/identity/experimental_identity_api.cc b/chrome/browser/extensions/api/identity/experimental_identity_api.cc
index 5839991..bb6d1c2 100644
--- a/chrome/browser/extensions/api/identity/experimental_identity_api.cc
+++ b/chrome/browser/extensions/api/identity/experimental_identity_api.cc
@@ -53,7 +53,7 @@ ExperimentalIdentityGetAuthTokenFunction::
~ExperimentalIdentityGetAuthTokenFunction() {}
bool ExperimentalIdentityGetAuthTokenFunction::RunImpl() {
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = identity_constants::kOffTheRecord;
return false;
}
@@ -144,7 +144,7 @@ void ExperimentalIdentityGetAuthTokenFunction::StartMintTokenFlow(
install_ui_.reset(
GetAssociatedWebContents()
? new ExtensionInstallPrompt(GetAssociatedWebContents())
- : new ExtensionInstallPrompt(profile(), NULL, NULL));
+ : new ExtensionInstallPrompt(GetProfile(), NULL, NULL));
ShowOAuthApprovalDialog(issue_advice_);
}
}
@@ -160,8 +160,9 @@ void ExperimentalIdentityGetAuthTokenFunction::OnMintTokenFailure(
case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
case GoogleServiceAuthError::ACCOUNT_DELETED:
case GoogleServiceAuthError::ACCOUNT_DISABLED:
- extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(
- profile())->ReportAuthError(error);
+ extensions::IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->ReportAuthError(error);
if (should_prompt_for_signin_) {
// Display a login prompt and try again (once).
StartSigninFlow();
@@ -227,7 +228,7 @@ void ExperimentalIdentityGetAuthTokenFunction::OnGetTokenFailure(
void ExperimentalIdentityGetAuthTokenFunction::StartLoginAccessTokenRequest() {
ProfileOAuth2TokenService* service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
#if defined(OS_CHROMEOS)
if (chrome::IsRunningInForcedAppMode()) {
std::string app_client_id;
@@ -256,7 +257,7 @@ void ExperimentalIdentityGetAuthTokenFunction::StartGaiaRequest(
}
void ExperimentalIdentityGetAuthTokenFunction::ShowLoginPopup() {
- signin_flow_.reset(new IdentitySigninFlow(this, profile()));
+ signin_flow_.reset(new IdentitySigninFlow(this, GetProfile()));
signin_flow_->Start();
}
@@ -275,22 +276,20 @@ ExperimentalIdentityGetAuthTokenFunction::CreateMintTokenFlow(
#endif
const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension());
- OAuth2MintTokenFlow* mint_token_flow =
- new OAuth2MintTokenFlow(
- profile()->GetRequestContext(),
- this,
- OAuth2MintTokenFlow::Parameters(
- login_access_token,
- GetExtension()->id(),
- oauth2_info.client_id,
- oauth2_info.scopes,
- gaia_mint_token_mode_));
+ OAuth2MintTokenFlow* mint_token_flow = new OAuth2MintTokenFlow(
+ GetProfile()->GetRequestContext(),
+ this,
+ OAuth2MintTokenFlow::Parameters(login_access_token,
+ GetExtension()->id(),
+ oauth2_info.client_id,
+ oauth2_info.scopes,
+ gaia_mint_token_mode_));
return mint_token_flow;
}
bool ExperimentalIdentityGetAuthTokenFunction::HasLoginToken() const {
ProfileOAuth2TokenService* token_service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
return token_service->RefreshTokenIsAvailable(
token_service->GetPrimaryAccountId());
}
@@ -305,7 +304,7 @@ ExperimentalIdentityLaunchWebAuthFlowFunction::
}
bool ExperimentalIdentityLaunchWebAuthFlowFunction::RunImpl() {
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = identity_constants::kOffTheRecord;
return false;
}
@@ -342,8 +341,7 @@ bool ExperimentalIdentityLaunchWebAuthFlowFunction::RunImpl() {
chrome::HostDesktopType host_desktop_type = current_browser ?
current_browser->host_desktop_type() : chrome::GetActiveDesktop();
auth_flow_.reset(new ExperimentalWebAuthFlow(
- this, profile(), auth_url, mode, initial_bounds,
- host_desktop_type));
+ this, GetProfile(), auth_url, mode, initial_bounds, host_desktop_type));
auth_flow_->Start();
return true;
}
diff --git a/chrome/browser/extensions/api/identity/experimental_identity_api.h b/chrome/browser/extensions/api/identity/experimental_identity_api.h
index af57d18..0085b5f 100644
--- a/chrome/browser/extensions/api/identity/experimental_identity_api.h
+++ b/chrome/browser/extensions/api/identity/experimental_identity_api.h
@@ -13,7 +13,7 @@
#include "chrome/browser/extensions/api/identity/experimental_web_auth_flow.h"
#include "chrome/browser/extensions/api/identity/identity_mint_queue.h"
#include "chrome/browser/extensions/api/identity/identity_signin_flow.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "google_apis/gaia/oauth2_mint_token_flow.h"
#include "google_apis/gaia/oauth2_token_service.h"
@@ -42,7 +42,7 @@ namespace extensions {
// new login token, there is a sign-in flow. If that flow completes
// successfully, getAuthToken proceeds to the non-interactive flow.
class ExperimentalIdentityGetAuthTokenFunction
- : public AsyncExtensionFunction,
+ : public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate,
public OAuth2MintTokenFlow::Delegate,
public IdentitySigninFlow::Delegate,
@@ -124,7 +124,7 @@ class ExperimentalIdentityGetAuthTokenFunction
};
class ExperimentalIdentityLaunchWebAuthFlowFunction
- : public AsyncExtensionFunction,
+ : public ChromeAsyncExtensionFunction,
public ExperimentalWebAuthFlow::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("experimental.identity.launchWebAuthFlow",
diff --git a/chrome/browser/extensions/api/identity/experimental_identity_apitest.cc b/chrome/browser/extensions/api/identity/experimental_identity_apitest.cc
index 0b8bcc7..19d537f 100644
--- a/chrome/browser/extensions/api/identity/experimental_identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/experimental_identity_apitest.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h"
@@ -94,7 +95,7 @@ class AsyncExtensionBrowserTest : public ExtensionBrowserTest {
function->set_extension(empty_extension.get());
}
- function->set_profile(browser()->profile());
+ function->set_context(browser()->profile());
function->set_has_callback(true);
function->Run();
}
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 2be5aed..fbbdca0 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -74,7 +74,7 @@ IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction()
IdentityGetAuthTokenFunction::~IdentityGetAuthTokenFunction() {}
bool IdentityGetAuthTokenFunction::RunImpl() {
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = identity_constants::kOffTheRecord;
return false;
}
@@ -146,7 +146,8 @@ void IdentityGetAuthTokenFunction::CompleteFunctionWithError(
void IdentityGetAuthTokenFunction::StartSigninFlow() {
// All cached tokens are invalid because the user is not signed in.
IdentityAPI* id_api =
- extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(profile_);
+ extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(
+ GetProfile());
id_api->EraseAllCachedTokens();
// Display a login prompt. If the subsequent mint fails, don't display the
// login prompt again.
@@ -164,7 +165,8 @@ void IdentityGetAuthTokenFunction::StartMintTokenFlow(
std::set<std::string> scopes(oauth2_info.scopes.begin(),
oauth2_info.scopes.end());
IdentityAPI* id_api =
- extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(profile_);
+ extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(
+ GetProfile());
if (!should_prompt_for_scopes_) {
// Caller requested no interaction.
@@ -195,18 +197,17 @@ void IdentityGetAuthTokenFunction::CompleteMintTokenFlow() {
std::set<std::string> scopes(oauth2_info.scopes.begin(),
oauth2_info.scopes.end());
- extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(
- profile_)->mint_queue()->RequestComplete(type,
- GetExtension()->id(),
- scopes,
- this);
+ extensions::IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->mint_queue()
+ ->RequestComplete(type, GetExtension()->id(), scopes, this);
}
void IdentityGetAuthTokenFunction::StartMintToken(
IdentityMintRequestQueue::MintType type) {
const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension());
- IdentityAPI* id_api = IdentityAPI::GetFactoryInstance()->GetForProfile(
- profile());
+ IdentityAPI* id_api =
+ IdentityAPI::GetFactoryInstance()->GetForProfile(GetProfile());
IdentityTokenCacheValue cache_entry = id_api->GetCachedToken(
GetExtension()->id(), oauth2_info.scopes);
IdentityTokenCacheValue::CacheValueStatus cache_status =
@@ -268,8 +269,9 @@ void IdentityGetAuthTokenFunction::OnMintTokenSuccess(
const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension());
IdentityTokenCacheValue token(access_token,
base::TimeDelta::FromSeconds(time_to_live));
- IdentityAPI::GetFactoryInstance()->GetForProfile(profile())->SetCachedToken(
- GetExtension()->id(), oauth2_info.scopes, token);
+ IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->SetCachedToken(GetExtension()->id(), oauth2_info.scopes, token);
CompleteMintTokenFlow();
CompleteFunctionWithResult(access_token);
@@ -283,8 +285,9 @@ void IdentityGetAuthTokenFunction::OnMintTokenFailure(
case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
case GoogleServiceAuthError::ACCOUNT_DELETED:
case GoogleServiceAuthError::ACCOUNT_DISABLED:
- extensions::IdentityAPI::GetFactoryInstance()->GetForProfile(
- profile())->ReportAuthError(error);
+ extensions::IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->ReportAuthError(error);
if (should_prompt_for_signin_) {
// Display a login prompt and try again (once).
StartSigninFlow();
@@ -303,9 +306,11 @@ void IdentityGetAuthTokenFunction::OnMintTokenFailure(
void IdentityGetAuthTokenFunction::OnIssueAdviceSuccess(
const IssueAdviceInfo& issue_advice) {
const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension());
- IdentityAPI::GetFactoryInstance()->GetForProfile(profile())->SetCachedToken(
- GetExtension()->id(), oauth2_info.scopes,
- IdentityTokenCacheValue(issue_advice));
+ IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->SetCachedToken(GetExtension()->id(),
+ oauth2_info.scopes,
+ IdentityTokenCacheValue(issue_advice));
CompleteMintTokenFlow();
should_prompt_for_signin_ = false;
@@ -370,7 +375,8 @@ void IdentityGetAuthTokenFunction::OnGaiaFlowCompleted(
const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension());
IdentityTokenCacheValue token_value(
access_token, base::TimeDelta::FromSeconds(time_to_live));
- IdentityAPI::GetFactoryInstance()->GetForProfile(profile())
+ IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
->SetCachedToken(GetExtension()->id(), oauth2_info.scopes, token_value);
}
@@ -419,7 +425,7 @@ void IdentityGetAuthTokenFunction::DidGetTokenService(
void IdentityGetAuthTokenFunction::StartLoginAccessTokenRequest() {
ProfileOAuth2TokenService* service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
#if defined(OS_CHROMEOS)
if (chrome::IsRunningInForcedAppMode()) {
std::string app_client_id;
@@ -448,7 +454,7 @@ void IdentityGetAuthTokenFunction::StartGaiaRequest(
}
void IdentityGetAuthTokenFunction::ShowLoginPopup() {
- signin_flow_.reset(new IdentitySigninFlow(this, profile()));
+ signin_flow_.reset(new IdentitySigninFlow(this, GetProfile()));
signin_flow_->Start();
}
@@ -459,7 +465,7 @@ void IdentityGetAuthTokenFunction::ShowOAuthApprovalDialog(
prefs::kApplicationLocale);
gaia_web_auth_flow_.reset(new GaiaWebAuthFlow(
- this, profile(), GetExtension()->id(), oauth2_info, locale));
+ this, GetProfile(), GetExtension()->id(), oauth2_info, locale));
gaia_web_auth_flow_->Start();
}
@@ -467,22 +473,20 @@ OAuth2MintTokenFlow* IdentityGetAuthTokenFunction::CreateMintTokenFlow(
const std::string& login_access_token) {
const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension());
- OAuth2MintTokenFlow* mint_token_flow =
- new OAuth2MintTokenFlow(
- profile()->GetRequestContext(),
- this,
- OAuth2MintTokenFlow::Parameters(
- login_access_token,
- GetExtension()->id(),
- oauth2_client_id_,
- oauth2_info.scopes,
- gaia_mint_token_mode_));
+ OAuth2MintTokenFlow* mint_token_flow = new OAuth2MintTokenFlow(
+ GetProfile()->GetRequestContext(),
+ this,
+ OAuth2MintTokenFlow::Parameters(login_access_token,
+ GetExtension()->id(),
+ oauth2_client_id_,
+ oauth2_info.scopes,
+ gaia_mint_token_mode_));
return mint_token_flow;
}
bool IdentityGetAuthTokenFunction::HasLoginToken() const {
ProfileOAuth2TokenService* token_service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
return token_service->RefreshTokenIsAvailable(
token_service->GetPrimaryAccountId());
}
@@ -521,7 +525,7 @@ IdentityRemoveCachedAuthTokenFunction::
}
bool IdentityRemoveCachedAuthTokenFunction::RunImpl() {
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = identity_constants::kOffTheRecord;
return false;
}
@@ -529,8 +533,9 @@ bool IdentityRemoveCachedAuthTokenFunction::RunImpl() {
scoped_ptr<identity::RemoveCachedAuthToken::Params> params(
identity::RemoveCachedAuthToken::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- IdentityAPI::GetFactoryInstance()->GetForProfile(profile())->EraseCachedToken(
- GetExtension()->id(), params->details.token);
+ IdentityAPI::GetFactoryInstance()
+ ->GetForProfile(GetProfile())
+ ->EraseCachedToken(GetExtension()->id(), params->details.token);
return true;
}
@@ -542,7 +547,7 @@ IdentityLaunchWebAuthFlowFunction::~IdentityLaunchWebAuthFlowFunction() {
}
bool IdentityLaunchWebAuthFlowFunction::RunImpl() {
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = identity_constants::kOffTheRecord;
return false;
}
@@ -562,7 +567,7 @@ bool IdentityLaunchWebAuthFlowFunction::RunImpl() {
AddRef(); // Balanced in OnAuthFlowSuccess/Failure.
- auth_flow_.reset(new WebAuthFlow(this, profile(), auth_url, mode));
+ auth_flow_.reset(new WebAuthFlow(this, GetProfile(), auth_url, mode));
auth_flow_->Start();
return true;
}
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index 09a585e..fc23788 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -19,7 +19,7 @@
#include "chrome/browser/extensions/api/identity/identity_signin_flow.h"
#include "chrome/browser/extensions/api/identity/web_auth_flow.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/signin/signin_global_error.h"
#include "google_apis/gaia/oauth2_mint_token_flow.h"
#include "google_apis/gaia/oauth2_token_service.h"
@@ -69,7 +69,7 @@ extern const char kPageLoadFailure[];
// profile will be signed in already, but if it turns out we need a
// new login token, there is a sign-in flow. If that flow completes
// successfully, getAuthToken proceeds to the non-interactive flow.
-class IdentityGetAuthTokenFunction : public AsyncExtensionFunction,
+class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction,
public GaiaWebAuthFlow::Delegate,
public IdentityMintRequestQueue::Request,
public OAuth2MintTokenFlow::Delegate,
@@ -178,7 +178,8 @@ class IdentityGetAuthTokenFunction : public AsyncExtensionFunction,
scoped_ptr<OAuth2TokenService::Request> login_token_request_;
};
-class IdentityRemoveCachedAuthTokenFunction : public SyncExtensionFunction {
+class IdentityRemoveCachedAuthTokenFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("identity.removeCachedAuthToken",
EXPERIMENTAL_IDENTITY_REMOVECACHEDAUTHTOKEN)
@@ -191,7 +192,7 @@ class IdentityRemoveCachedAuthTokenFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class IdentityLaunchWebAuthFlowFunction : public AsyncExtensionFunction,
+class IdentityLaunchWebAuthFlowFunction : public ChromeAsyncExtensionFunction,
public WebAuthFlow::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("identity.launchWebAuthFlow",
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index a0708c6..3050998 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_switches.h"
@@ -104,7 +105,7 @@ class AsyncExtensionBrowserTest : public ExtensionBrowserTest {
function->set_extension(empty_extension.get());
}
- function->set_profile(browser()->profile());
+ function->set_context(browser()->profile());
function->set_has_callback(true);
function->Run();
}
diff --git a/chrome/browser/extensions/api/idle/idle_api.cc b/chrome/browser/extensions/api/idle/idle_api.cc
index 1cd1fe4..2a0d2d8 100644
--- a/chrome/browser/extensions/api/idle/idle_api.cc
+++ b/chrome/browser/extensions/api/idle/idle_api.cc
@@ -35,9 +35,8 @@ bool IdleQueryStateFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &threshold));
threshold = ClampThreshold(threshold);
- IdleManagerFactory::GetForProfile(profile())->QueryState(
- threshold,
- base::Bind(&IdleQueryStateFunction::IdleStateCallback, this));
+ IdleManagerFactory::GetForProfile(GetProfile())->QueryState(
+ threshold, base::Bind(&IdleQueryStateFunction::IdleStateCallback, this));
// Don't send the response, it'll be sent by our callback
return true;
@@ -53,8 +52,8 @@ bool IdleSetDetectionIntervalFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &threshold));
threshold = ClampThreshold(threshold);
- IdleManagerFactory::GetForProfile(profile())->SetThreshold(extension_id(),
- threshold);
+ IdleManagerFactory::GetForProfile(GetProfile())
+ ->SetThreshold(extension_id(), threshold);
return true;
}
diff --git a/chrome/browser/extensions/api/idle/idle_api.h b/chrome/browser/extensions/api/idle/idle_api.h
index e913835..e14f1de 100644
--- a/chrome/browser/extensions/api/idle/idle_api.h
+++ b/chrome/browser/extensions/api/idle/idle_api.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_IDLE_IDLE_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/idle.h"
namespace extensions {
// Implementation of the chrome.idle.queryState API.
-class IdleQueryStateFunction : public AsyncExtensionFunction {
+class IdleQueryStateFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("idle.queryState", IDLE_QUERYSTATE)
@@ -26,7 +26,7 @@ class IdleQueryStateFunction : public AsyncExtensionFunction {
};
// Implementation of the chrome.idle.setDetectionInterval API.
-class IdleSetDetectionIntervalFunction : public SyncExtensionFunction {
+class IdleSetDetectionIntervalFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("idle.setDetectionInterval",
IDLE_SETDETECTIONINTERVAL)
diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc b/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
index a9834be..6157489 100644
--- a/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
+++ b/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.cc
@@ -46,7 +46,7 @@ bool ImageWriterPrivateWriteFromUrlFunction::RunImpl() {
hash = *params->options->image_hash;
}
- image_writer::OperationManager::Get(profile())->StartWriteFromUrl(
+ image_writer::OperationManager::Get(GetProfile())->StartWriteFromUrl(
extension_id(),
url,
render_view_host(),
@@ -81,7 +81,7 @@ bool ImageWriterPrivateWriteFromFileFunction::RunImpl() {
image_writer_api::WriteFromFile::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- image_writer::OperationManager::Get(profile())->StartWriteFromFile(
+ image_writer::OperationManager::Get(GetProfile())->StartWriteFromFile(
extension_id(),
params->storage_unit_id,
base::Bind(&ImageWriterPrivateWriteFromFileFunction::OnWriteStarted,
@@ -106,11 +106,10 @@ ImageWriterPrivateCancelWriteFunction::
}
bool ImageWriterPrivateCancelWriteFunction::RunImpl() {
- image_writer::OperationManager::Get(profile())->
- CancelWrite(
- extension_id(),
- base::Bind(&ImageWriterPrivateCancelWriteFunction::OnWriteCancelled,
- this));
+ image_writer::OperationManager::Get(GetProfile())->CancelWrite(
+ extension_id(),
+ base::Bind(&ImageWriterPrivateCancelWriteFunction::OnWriteCancelled,
+ this));
return true;
}
diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.h b/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.h
index 7a4860d..4789d18 100644
--- a/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.h
+++ b/chrome/browser/extensions/api/image_writer_private/image_writer_private_api.h
@@ -5,12 +5,13 @@
#define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_IMAGE_WRITER_PRIVATE_API_H_
#include "chrome/browser/extensions/api/image_writer_private/removable_storage_provider.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/image_writer_private.h"
namespace extensions {
-class ImageWriterPrivateWriteFromUrlFunction : public AsyncExtensionFunction {
+class ImageWriterPrivateWriteFromUrlFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("imageWriterPrivate.writeFromUrl",
IMAGEWRITER_WRITEFROMURL)
@@ -22,7 +23,8 @@ class ImageWriterPrivateWriteFromUrlFunction : public AsyncExtensionFunction {
void OnWriteStarted(bool success, const std::string& error);
};
-class ImageWriterPrivateWriteFromFileFunction : public AsyncExtensionFunction {
+class ImageWriterPrivateWriteFromFileFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("imageWriterPrivate.writeFromFile",
IMAGEWRITER_WRITEFROMFILE)
@@ -34,7 +36,8 @@ class ImageWriterPrivateWriteFromFileFunction : public AsyncExtensionFunction {
void OnWriteStarted(bool success, const std::string& error);
};
-class ImageWriterPrivateCancelWriteFunction : public AsyncExtensionFunction {
+class ImageWriterPrivateCancelWriteFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("imageWriterPrivate.cancelWrite",
IMAGEWRITER_CANCELWRITE)
@@ -47,7 +50,7 @@ class ImageWriterPrivateCancelWriteFunction : public AsyncExtensionFunction {
};
class ImageWriterPrivateDestroyPartitionsFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("imageWriterPrivate.destroyPartitions",
IMAGEWRITER_DESTROYPARTITIONS)
@@ -59,7 +62,7 @@ class ImageWriterPrivateDestroyPartitionsFunction
};
class ImageWriterPrivateListRemovableStorageDevicesFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("imageWriterPrivate.listRemovableStorageDevices",
IMAGEWRITER_LISTREMOVABLESTORAGEDEVICES);
diff --git a/chrome/browser/extensions/api/location/location_api.cc b/chrome/browser/extensions/api/location/location_api.cc
index 41a9917..cc17f70 100644
--- a/chrome/browser/extensions/api/location/location_api.cc
+++ b/chrome/browser/extensions/api/location/location_api.cc
@@ -48,11 +48,11 @@ bool LocationWatchLocationFunction::RunImpl() {
}
// TODO(vadimt): validate and use params->request_info.maximumAge
- LocationManager::Get(profile())->AddLocationRequest(
- extension_id(),
- params->name,
- min_distance_in_meters,
- min_time_in_milliseconds);
+ LocationManager::Get(GetProfile())
+ ->AddLocationRequest(extension_id(),
+ params->name,
+ min_distance_in_meters,
+ min_time_in_milliseconds);
return true;
}
@@ -62,8 +62,8 @@ bool LocationClearWatchFunction::RunImpl() {
ClearWatch::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- LocationManager::Get(profile())->RemoveLocationRequest(
- extension_id(), params->name);
+ LocationManager::Get(GetProfile())
+ ->RemoveLocationRequest(extension_id(), params->name);
return true;
}
diff --git a/chrome/browser/extensions/api/location/location_api.h b/chrome/browser/extensions/api/location/location_api.h
index bb5e692..929287c 100644
--- a/chrome/browser/extensions/api/location/location_api.h
+++ b/chrome/browser/extensions/api/location/location_api.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_API_H_
-#include "chrome/browser/extensions/api/api_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
-class LocationWatchLocationFunction : public SyncExtensionFunction {
+class LocationWatchLocationFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("location.watchLocation",
LOCATION_WATCHLOCATION)
@@ -21,7 +21,7 @@ class LocationWatchLocationFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class LocationClearWatchFunction : public SyncExtensionFunction {
+class LocationClearWatchFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("location.clearWatch",
LOCATION_CLEARWATCH)
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc
index afad4c9..21c6418 100644
--- a/chrome/browser/extensions/api/management/management_api.cc
+++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -225,16 +225,16 @@ void AddExtensionInfo(const ExtensionSet& extensions,
} // namespace
ExtensionService* ManagementFunction::service() {
- return profile()->GetExtensionService();
+ return GetProfile()->GetExtensionService();
}
ExtensionService* AsyncManagementFunction::service() {
- return profile()->GetExtensionService();
+ return GetProfile()->GetExtensionService();
}
bool ManagementGetAllFunction::RunImpl() {
ExtensionInfoList extensions;
- ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
AddExtensionInfo(*service()->extensions(), system, &extensions);
AddExtensionInfo(*service()->disabled_extensions(), system, &extensions);
@@ -256,8 +256,8 @@ bool ManagementGetFunction::RunImpl() {
return false;
}
- scoped_ptr<management::ExtensionInfo> info = CreateExtensionInfo(
- *extension, ExtensionSystem::Get(profile()));
+ scoped_ptr<management::ExtensionInfo> info =
+ CreateExtensionInfo(*extension, ExtensionSystem::Get(GetProfile()));
results_ = management::Get::Results::Create(*info);
return true;
@@ -438,8 +438,8 @@ bool ManagementLaunchAppFunction::RunImpl() {
extension_misc::LaunchContainer launch_container =
service()->extension_prefs()->GetLaunchContainer(
extension, ExtensionPrefs::LAUNCH_DEFAULT);
- OpenApplication(AppLaunchParams(profile(), extension, launch_container,
- NEW_FOREGROUND_TAB));
+ OpenApplication(AppLaunchParams(
+ GetProfile(), extension, launch_container, NEW_FOREGROUND_TAB));
#if !defined(OS_ANDROID)
CoreAppLauncherHandler::RecordAppLaunchType(
extension_misc::APP_LAUNCH_EXTENSION_API,
@@ -469,8 +469,8 @@ bool ManagementSetEnabledFunction::RunImpl() {
return false;
}
- const ManagementPolicy* policy = ExtensionSystem::Get(profile())->
- management_policy();
+ const ManagementPolicy* policy =
+ ExtensionSystem::Get(GetProfile())->management_policy();
if (!policy->UserMayModifySettings(extension, NULL)) {
error_ = ErrorUtils::FormatErrorMessage(
keys::kUserCantModifyError, extension_id_);
@@ -534,8 +534,9 @@ bool ManagementUninstallFunctionBase::Uninstall(
return false;
}
- if (!ExtensionSystem::Get(profile())->management_policy()->
- UserMayModifySettings(extension, NULL)) {
+ if (!ExtensionSystem::Get(GetProfile())
+ ->management_policy()
+ ->UserMayModifySettings(extension, NULL)) {
error_ = ErrorUtils::FormatErrorMessage(
keys::kUserCantModifyError, extension_id_);
return false;
@@ -545,7 +546,7 @@ bool ManagementUninstallFunctionBase::Uninstall(
if (show_confirm_dialog) {
AddRef(); // Balanced in ExtensionUninstallAccepted/Canceled
extension_uninstall_dialog_.reset(ExtensionUninstallDialog::Create(
- profile(), GetCurrentBrowser(), this));
+ GetProfile(), GetCurrentBrowser(), this));
extension_uninstall_dialog_->ConfirmUninstall(extension);
} else {
Finish(true);
diff --git a/chrome/browser/extensions/api/management/management_api.h b/chrome/browser/extensions/api/management/management_api.h
index f9566ea..c61ea17 100644
--- a/chrome/browser/extensions/api/management/management_api.h
+++ b/chrome/browser/extensions/api/management/management_api.h
@@ -7,8 +7,8 @@
#include "base/compiler_specific.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
@@ -20,14 +20,14 @@ class ExtensionUninstallDialog;
namespace extensions {
-class ManagementFunction : public SyncExtensionFunction {
+class ManagementFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~ManagementFunction() {}
ExtensionService* service();
};
-class AsyncManagementFunction : public AsyncExtensionFunction {
+class AsyncManagementFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~AsyncManagementFunction() {}
@@ -69,7 +69,7 @@ class ManagementGetPermissionWarningsByIdFunction : public ManagementFunction {
};
class ManagementGetPermissionWarningsByManifestFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"management.getPermissionWarningsByManifest",
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 0358fa3..63ccf71 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -218,8 +218,8 @@ void MediaGalleriesGetMediaFileSystemsFunction::ShowDialog() {
// If there is no WebContentsModalDialogManager, then this contents is
// probably the background page for an app. Try to find a shell window to
// host the dialog.
- ShellWindow* window = apps::ShellWindowRegistry::Get(profile())->
- GetCurrentShellWindowForApp(GetExtension()->id());
+ ShellWindow* window = apps::ShellWindowRegistry::Get(
+ GetProfile())->GetCurrentShellWindowForApp(GetExtension()->id());
if (window) {
contents = window->web_contents();
} else {
@@ -241,8 +241,9 @@ void MediaGalleriesGetMediaFileSystemsFunction::GetMediaFileSystemsForExtension(
cb.Run(std::vector<MediaFileSystemInfo>());
return;
}
- DCHECK(g_browser_process->media_file_system_registry()->
- GetPreferences(profile_)->IsInitialized());
+ DCHECK(g_browser_process->media_file_system_registry()
+ ->GetPreferences(GetProfile())
+ ->IsInitialized());
MediaFileSystemRegistry* registry =
g_browser_process->media_file_system_registry();
registry->GetMediaFileSystemsForExtension(
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
index 8c2703c..c9abd3f 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.h
@@ -10,7 +10,7 @@
#include <vector>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/media_galleries/media_file_system_registry.h"
#include "chrome/common/extensions/api/media_galleries.h"
@@ -19,7 +19,7 @@ namespace MediaGalleries = extensions::api::media_galleries;
namespace extensions {
class MediaGalleriesGetMediaFileSystemsFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("mediaGalleries.getMediaFileSystems",
MEDIAGALLERIES_GETMEDIAFILESYSTEMS)
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
index 2fb85d7..3cc95b0 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
@@ -164,7 +164,7 @@ MediaGalleriesPrivateAddGalleryWatchFunction::
}
bool MediaGalleriesPrivateAddGalleryWatchFunction::RunImpl() {
- DCHECK(profile_);
+ DCHECK(GetProfile());
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (!render_view_host() || !render_view_host()->GetProcess())
return false;
@@ -174,7 +174,8 @@ bool MediaGalleriesPrivateAddGalleryWatchFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
MediaGalleriesPreferences* preferences =
- g_browser_process->media_file_system_registry()->GetPreferences(profile_);
+ g_browser_process->media_file_system_registry()->GetPreferences(
+ GetProfile());
preferences->EnsureInitialized(base::Bind(
&MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit,
this,
@@ -187,8 +188,11 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit(
const std::string& pref_id) {
base::FilePath gallery_file_path;
MediaGalleryPrefId gallery_pref_id = 0;
- if (!GetGalleryFilePathAndId(pref_id, profile_, GetExtension(),
- &gallery_file_path, &gallery_pref_id)) {
+ if (!GetGalleryFilePathAndId(pref_id,
+ GetProfile(),
+ GetExtension(),
+ &gallery_file_path,
+ &gallery_pref_id)) {
error_ = kInvalidGalleryIDError;
HandleResponse(gallery_pref_id, false);
return;
@@ -196,13 +200,13 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::OnPreferencesInit(
#if defined(OS_WIN)
MediaGalleriesPrivateEventRouter* router =
- MediaGalleriesPrivateAPI::Get(profile_)->GetEventRouter();
+ MediaGalleriesPrivateAPI::Get(GetProfile())->GetEventRouter();
DCHECK(router);
content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&GalleryWatchManager::SetupGalleryWatch,
- profile_,
+ GetProfile(),
gallery_pref_id,
gallery_file_path,
extension_id(),
@@ -226,10 +230,11 @@ void MediaGalleriesPrivateAddGalleryWatchFunction::HandleResponse(
result.success = success;
SetResult(result.ToValue().release());
if (success) {
- DCHECK(g_browser_process->media_file_system_registry()->
- GetPreferences(profile_)->IsInitialized());
- GalleryWatchStateTracker* state_tracker =
- MediaGalleriesPrivateAPI::Get(profile_)->GetGalleryWatchStateTracker();
+ DCHECK(g_browser_process->media_file_system_registry()
+ ->GetPreferences(GetProfile())
+ ->IsInitialized());
+ GalleryWatchStateTracker* state_tracker = MediaGalleriesPrivateAPI::Get(
+ GetProfile())->GetGalleryWatchStateTracker();
state_tracker->OnGalleryWatchAdded(extension_id(), gallery_id);
}
SendResponse(true);
@@ -256,7 +261,8 @@ bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
MediaGalleriesPreferences* preferences =
- g_browser_process->media_file_system_registry()->GetPreferences(profile_);
+ g_browser_process->media_file_system_registry()->GetPreferences(
+ GetProfile());
preferences->EnsureInitialized(base::Bind(
&MediaGalleriesPrivateRemoveGalleryWatchFunction::OnPreferencesInit,
this,
@@ -269,22 +275,26 @@ void MediaGalleriesPrivateRemoveGalleryWatchFunction::OnPreferencesInit(
#if defined(OS_WIN)
base::FilePath gallery_file_path;
MediaGalleryPrefId gallery_pref_id = 0;
- if (!GetGalleryFilePathAndId(pref_id, profile_, GetExtension(),
- &gallery_file_path, &gallery_pref_id)) {
+ if (!GetGalleryFilePathAndId(pref_id,
+ GetProfile(),
+ GetExtension(),
+ &gallery_file_path,
+ &gallery_pref_id)) {
error_ = kInvalidGalleryIDError;
SendResponse(false);
return;
}
content::BrowserThread::PostTask(
- content::BrowserThread::FILE, FROM_HERE,
+ content::BrowserThread::FILE,
+ FROM_HERE,
base::Bind(&GalleryWatchManager::RemoveGalleryWatch,
- profile_,
+ GetProfile(),
gallery_file_path,
extension_id()));
- GalleryWatchStateTracker* state_tracker =
- MediaGalleriesPrivateAPI::Get(profile_)->GetGalleryWatchStateTracker();
+ GalleryWatchStateTracker* state_tracker = MediaGalleriesPrivateAPI::Get(
+ GetProfile())->GetGalleryWatchStateTracker();
state_tracker->OnGalleryWatchRemoved(extension_id(), gallery_pref_id);
#endif
SendResponse(true);
@@ -304,7 +314,8 @@ bool MediaGalleriesPrivateGetAllGalleryWatchFunction::RunImpl() {
return false;
MediaGalleriesPreferences* preferences =
- g_browser_process->media_file_system_registry()->GetPreferences(profile_);
+ g_browser_process->media_file_system_registry()->GetPreferences(
+ GetProfile());
preferences->EnsureInitialized(base::Bind(
&MediaGalleriesPrivateGetAllGalleryWatchFunction::OnPreferencesInit,
this));
@@ -314,8 +325,8 @@ bool MediaGalleriesPrivateGetAllGalleryWatchFunction::RunImpl() {
void MediaGalleriesPrivateGetAllGalleryWatchFunction::OnPreferencesInit() {
std::vector<std::string> result;
#if defined(OS_WIN)
- GalleryWatchStateTracker* state_tracker =
- MediaGalleriesPrivateAPI::Get(profile_)->GetGalleryWatchStateTracker();
+ GalleryWatchStateTracker* state_tracker = MediaGalleriesPrivateAPI::Get(
+ GetProfile())->GetGalleryWatchStateTracker();
MediaGalleryPrefIdSet gallery_ids =
state_tracker->GetAllWatchedGalleryIDsForExtension(extension_id());
for (MediaGalleryPrefIdSet::const_iterator iter = gallery_ids.begin();
@@ -341,7 +352,8 @@ bool MediaGalleriesPrivateRemoveAllGalleryWatchFunction::RunImpl() {
return false;
MediaGalleriesPreferences* preferences =
- g_browser_process->media_file_system_registry()->GetPreferences(profile_);
+ g_browser_process->media_file_system_registry()->GetPreferences(
+ GetProfile());
preferences->EnsureInitialized(base::Bind(
&MediaGalleriesPrivateRemoveAllGalleryWatchFunction::OnPreferencesInit,
this));
@@ -351,9 +363,10 @@ bool MediaGalleriesPrivateRemoveAllGalleryWatchFunction::RunImpl() {
void MediaGalleriesPrivateRemoveAllGalleryWatchFunction::OnPreferencesInit() {
#if defined(OS_WIN)
MediaGalleriesPreferences* preferences =
- g_browser_process->media_file_system_registry()->GetPreferences(profile_);
- GalleryWatchStateTracker* state_tracker =
- MediaGalleriesPrivateAPI::Get(profile_)->GetGalleryWatchStateTracker();
+ g_browser_process->media_file_system_registry()->GetPreferences(
+ GetProfile());
+ GalleryWatchStateTracker* state_tracker = MediaGalleriesPrivateAPI::Get(
+ GetProfile())->GetGalleryWatchStateTracker();
state_tracker->RemoveAllGalleryWatchersForExtension(
extension_id(), preferences);
#endif
@@ -372,7 +385,7 @@ bool MediaGalleriesPrivateGetHandlersFunction::RunImpl() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
ExtensionService* service =
- extensions::ExtensionSystem::Get(profile_)->extension_service();
+ extensions::ExtensionSystem::Get(GetProfile())->extension_service();
DCHECK(service);
ListValue* result_list = new ListValue;
@@ -381,7 +394,7 @@ bool MediaGalleriesPrivateGetHandlersFunction::RunImpl() {
iter != service->extensions()->end();
++iter) {
const Extension* extension = iter->get();
- if (profile_->IsOffTheRecord() &&
+ if (GetProfile()->IsOffTheRecord() &&
!extension_util::IsIncognitoEnabled(extension->id(), service))
continue;
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h
index b2b27c2..129296f 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h
@@ -12,8 +12,8 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_state_tracker.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/media_galleries/media_galleries_preferences.h"
#include "chrome/common/extensions/api/media_galleries_private.h"
@@ -74,7 +74,7 @@ class MediaGalleriesPrivateAPI : public ProfileKeyedAPI,
// Implements the chrome.mediaGalleriesPrivate.addGalleryWatch method.
class MediaGalleriesPrivateAddGalleryWatchFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.addGalleryWatch",
MEDIAGALLERIESPRIVATE_ADDGALLERYWATCH);
@@ -94,7 +94,7 @@ class MediaGalleriesPrivateAddGalleryWatchFunction
// Implements the chrome.mediaGalleriesPrivate.removeGalleryWatch method.
class MediaGalleriesPrivateRemoveGalleryWatchFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.removeGalleryWatch",
MEDIAGALLERIESPRIVATE_REMOVEGALLERYWATCH);
@@ -111,7 +111,7 @@ class MediaGalleriesPrivateRemoveGalleryWatchFunction
// Implements the chrome.mediaGalleriesPrivate.getAllGalleryWatch method.
class MediaGalleriesPrivateGetAllGalleryWatchFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.getAllGalleryWatch",
MEDIAGALLERIESPRIVATE_GETALLGALLERYWATCH);
@@ -127,7 +127,7 @@ class MediaGalleriesPrivateGetAllGalleryWatchFunction
// Implements the chrome.mediaGalleriesPrivate.removeAllGalleryWatch method.
class MediaGalleriesPrivateRemoveAllGalleryWatchFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.removeAllGalleryWatch",
MEDIAGALLERIESPRIVATE_REMOVEALLGALLERYWATCH);
@@ -143,7 +143,7 @@ class MediaGalleriesPrivateRemoveAllGalleryWatchFunction
// Implements the chrome.mediaGalleriesPrivate.getHandlers method.
class MediaGalleriesPrivateGetHandlersFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("mediaGalleriesPrivate.getHandlers",
MEDIAGALLERIESPRIVATE_GETHANDLERS);
diff --git a/chrome/browser/extensions/api/module/module.cc b/chrome/browser/extensions/api/module/module.cc
index 31e849c..8847359 100644
--- a/chrome/browser/extensions/api/module/module.cc
+++ b/chrome/browser/extensions/api/module/module.cc
@@ -39,16 +39,14 @@ bool ExtensionSetUpdateUrlDataFunction::RunImpl() {
std::string data;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &data));
- ExtensionPrefs::Get(profile())->UpdateExtensionPref(
- extension_id(),
- extension::kUpdateURLData,
- new base::StringValue(data));
+ ExtensionPrefs::Get(GetProfile())->UpdateExtensionPref(
+ extension_id(), extension::kUpdateURLData, new base::StringValue(data));
return true;
}
bool ExtensionIsAllowedIncognitoAccessFunction::RunImpl() {
ExtensionService* ext_service =
- ExtensionSystem::Get(profile())->extension_service();
+ ExtensionSystem::Get(GetProfile())->extension_service();
const Extension* extension = GetExtension();
SetResult(new base::FundamentalValue(
@@ -58,7 +56,7 @@ bool ExtensionIsAllowedIncognitoAccessFunction::RunImpl() {
bool ExtensionIsAllowedFileSchemeAccessFunction::RunImpl() {
ExtensionService* ext_service =
- ExtensionSystem::Get(profile())->extension_service();
+ ExtensionSystem::Get(GetProfile())->extension_service();
const Extension* extension = GetExtension();
SetResult(new base::FundamentalValue(
diff --git a/chrome/browser/extensions/api/module/module.h b/chrome/browser/extensions/api/module/module.h
index 37f627d..4f4af03 100644
--- a/chrome/browser/extensions/api/module/module.h
+++ b/chrome/browser/extensions/api/module/module.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_MODULE_MODULE_H_
#define CHROME_BROWSER_EXTENSIONS_API_MODULE_MODULE_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
class ExtensionPrefs;
@@ -16,7 +16,7 @@ std::string GetUpdateURLData(const ExtensionPrefs* prefs,
const std::string& extension_id);
} // namespace extension
-class ExtensionSetUpdateUrlDataFunction : public SyncExtensionFunction {
+class ExtensionSetUpdateUrlDataFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("extension.setUpdateUrlData",
EXTENSION_SETUPDATEURLDATA)
@@ -28,7 +28,8 @@ class ExtensionSetUpdateUrlDataFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class ExtensionIsAllowedIncognitoAccessFunction : public SyncExtensionFunction {
+class ExtensionIsAllowedIncognitoAccessFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("extension.isAllowedIncognitoAccess",
EXTENSION_ISALLOWEDINCOGNITOACCESS)
@@ -41,7 +42,7 @@ class ExtensionIsAllowedIncognitoAccessFunction : public SyncExtensionFunction {
};
class ExtensionIsAllowedFileSchemeAccessFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("extension.isAllowedFileSchemeAccess",
EXTENSION_ISALLOWEDFILESCHEMEACCESS)
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api.h b/chrome/browser/extensions/api/networking_private/networking_private_api.h
index 08b2708..2abe33e 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_api.h
+++ b/chrome/browser/extensions/api/networking_private/networking_private_api.h
@@ -12,12 +12,13 @@
#include "base/memory/ref_counted.h"
#include "base/values.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
// Implements the chrome.networkingPrivate.getProperties method.
-class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction {
+class NetworkingPrivateGetPropertiesFunction
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateGetPropertiesFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties",
@@ -39,7 +40,7 @@ class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction {
// Implements the chrome.networkingPrivate.getManagedProperties method.
class NetworkingPrivateGetManagedPropertiesFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateGetManagedPropertiesFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.getManagedProperties",
@@ -62,7 +63,7 @@ class NetworkingPrivateGetManagedPropertiesFunction
};
// Implements the chrome.networkingPrivate.getState method.
-class NetworkingPrivateGetStateFunction : public AsyncExtensionFunction {
+class NetworkingPrivateGetStateFunction : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateGetStateFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.getState",
@@ -79,7 +80,8 @@ class NetworkingPrivateGetStateFunction : public AsyncExtensionFunction {
};
// Implements the chrome.networkingPrivate.setProperties method.
-class NetworkingPrivateSetPropertiesFunction : public AsyncExtensionFunction {
+class NetworkingPrivateSetPropertiesFunction
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateSetPropertiesFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.setProperties",
@@ -99,7 +101,8 @@ class NetworkingPrivateSetPropertiesFunction : public AsyncExtensionFunction {
};
// Implements the chrome.networkingPrivate.createNetwork method.
-class NetworkingPrivateCreateNetworkFunction : public AsyncExtensionFunction {
+class NetworkingPrivateCreateNetworkFunction
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateCreateNetworkFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.createNetwork",
@@ -120,7 +123,7 @@ class NetworkingPrivateCreateNetworkFunction : public AsyncExtensionFunction {
// Implements the chrome.networkingPrivate.getVisibleNetworks method.
class NetworkingPrivateGetVisibleNetworksFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
NetworkingPrivateGetVisibleNetworksFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks",
@@ -138,7 +141,7 @@ class NetworkingPrivateGetVisibleNetworksFunction
// Implements the chrome.networkingPrivate.getEnabledNetworkTypes method.
class NetworkingPrivateGetEnabledNetworkTypesFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
NetworkingPrivateGetEnabledNetworkTypesFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes",
@@ -156,7 +159,7 @@ class NetworkingPrivateGetEnabledNetworkTypesFunction
// Implements the chrome.networkingPrivate.enableNetworkType method.
class NetworkingPrivateEnableNetworkTypeFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
NetworkingPrivateEnableNetworkTypeFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType",
@@ -174,7 +177,7 @@ class NetworkingPrivateEnableNetworkTypeFunction
// Implements the chrome.networkingPrivate.disableNetworkType method.
class NetworkingPrivateDisableNetworkTypeFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
NetworkingPrivateDisableNetworkTypeFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType",
@@ -192,7 +195,7 @@ class NetworkingPrivateDisableNetworkTypeFunction
// Implements the chrome.networkingPrivate.requestNetworkScan method.
class NetworkingPrivateRequestNetworkScanFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
NetworkingPrivateRequestNetworkScanFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan",
@@ -210,7 +213,8 @@ class NetworkingPrivateRequestNetworkScanFunction
// Implements the chrome.networkingPrivate.startConnect method.
-class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction {
+class NetworkingPrivateStartConnectFunction
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateStartConnectFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
@@ -236,7 +240,7 @@ class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction {
// Implements the chrome.networkingPrivate.startDisconnect method.
class NetworkingPrivateStartDisconnectFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateStartDisconnectFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
@@ -262,7 +266,7 @@ class NetworkingPrivateStartDisconnectFunction
// Implements the chrome.networkingPrivate.verifyDestination method.
class NetworkingPrivateVerifyDestinationFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateVerifyDestinationFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination",
@@ -283,7 +287,7 @@ class NetworkingPrivateVerifyDestinationFunction
// Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method.
class NetworkingPrivateVerifyAndEncryptCredentialsFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateVerifyAndEncryptCredentialsFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials",
@@ -305,7 +309,7 @@ class NetworkingPrivateVerifyAndEncryptCredentialsFunction
// Implements the chrome.networkingPrivate.verifyAndEncryptData method.
class NetworkingPrivateVerifyAndEncryptDataFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
NetworkingPrivateVerifyAndEncryptDataFunction() {}
DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData",
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc
index a2f6e797..82633a5 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc
@@ -120,7 +120,7 @@ bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params);
std::string user_id_hash;
- GetUserIdHash(profile());
+ GetUserIdHash(GetProfile());
NetworkHandler::Get()->managed_network_configuration_handler()->
GetManagedProperties(
user_id_hash,
@@ -231,7 +231,7 @@ bool NetworkingPrivateCreateNetworkFunction::RunImpl() {
std::string user_id_hash;
if (!params->shared)
- user_id_hash = GetUserIdHash(profile());
+ user_id_hash = GetUserIdHash(GetProfile());
scoped_ptr<base::DictionaryValue> properties_dict(
params->properties.ToValue());
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
index 467b9b7..f688f47 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_api_nonchromeos.cc
@@ -44,8 +44,8 @@ bool NetworkingPrivateGetPropertiesFunction::RunImpl() {
// If there are properties set by SetProperties function, use those.
NetworkingPrivatePropertiesData* stored_properties =
- static_cast<NetworkingPrivatePropertiesData*> (
- profile()->GetUserData(kNetworkingPrivateProperties));
+ static_cast<NetworkingPrivatePropertiesData*>(
+ GetProfile()->GetUserData(kNetworkingPrivateProperties));
if (stored_properties != NULL) {
SetResult(stored_properties->properties_.release());
SendResponse(true);
@@ -185,8 +185,9 @@ bool NetworkingPrivateSetPropertiesFunction::RunImpl() {
params->properties.ToValue());
// Store properties_dict in profile to return from GetProperties.
- profile()->SetUserData(kNetworkingPrivateProperties,
- new NetworkingPrivatePropertiesData(properties_dict.get()));
+ GetProfile()->SetUserData(
+ kNetworkingPrivateProperties,
+ new NetworkingPrivatePropertiesData(properties_dict.get()));
SendResponse(true);
return true;
}
@@ -207,7 +208,7 @@ bool NetworkingPrivateCreateNetworkFunction::RunImpl() {
scoped_ptr<base::DictionaryValue> properties_dict(
params->properties.ToValue());
properties_dict->SetString("GUID", "fake_guid");
- profile()->SetUserData(
+ GetProfile()->SetUserData(
kNetworkingPrivateProperties,
new NetworkingPrivatePropertiesData(properties_dict.get()));
@@ -351,7 +352,8 @@ bool NetworkingPrivateRequestNetworkScanFunction::RunImpl() {
changes.push_back("stub_wifi2");
changes.push_back("stub_cellular1");
- EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router();
+ EventRouter* event_router =
+ ExtensionSystem::Get(GetProfile())->event_router();
scoped_ptr<base::ListValue> args(api::OnNetworkListChanged::Create(changes));
scoped_ptr<extensions::Event> extension_event(new extensions::Event(
api::OnNetworkListChanged::kEventName, args.Pass()));
@@ -388,13 +390,14 @@ bool NetworkingPrivateStartConnectFunction::RunImpl() {
"\"SignalStrength\":80}}";
// Store network_properties in profile to return from GetProperties.
- profile()->SetUserData(kNetworkingPrivateProperties,
- new NetworkingPrivatePropertiesData(
- static_cast<DictionaryValue*>(
- base::JSONReader::Read(network_properties))));
+ GetProfile()->SetUserData(
+ kNetworkingPrivateProperties,
+ new NetworkingPrivatePropertiesData(static_cast<DictionaryValue*>(
+ base::JSONReader::Read(network_properties))));
// Broadcast NetworksChanged Event that network is connected
- EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router();
+ EventRouter* event_router =
+ ExtensionSystem::Get(GetProfile())->event_router();
scoped_ptr<base::ListValue> args(api::OnNetworksChanged::Create(
std::vector<std::string>(1, params->network_guid)));
scoped_ptr<extensions::Event> netchanged_event(
@@ -435,7 +438,8 @@ bool NetworkingPrivateStartDisconnectFunction::RunImpl() {
SendResponse(true);
// Send Event that network is disconnected. Listener will use GetProperties.
- EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router();
+ EventRouter* event_router =
+ ExtensionSystem::Get(GetProfile())->event_router();
scoped_ptr<base::ListValue> args(api::OnNetworksChanged::Create(
std::vector<std::string>(1, params->network_guid)));
scoped_ptr<extensions::Event> extension_event(
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc
index 3418c43..56203e1 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_api.cc
@@ -327,10 +327,8 @@ bool NotificationsApiFunction::CreateNotification(
optional_fields.clickable = *options->is_clickable;
NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate(
- this,
- profile(),
- extension_->id(),
- id)); // ownership is passed to Notification
+ this, GetProfile(), extension_->id(), id)); // ownership is passed to
+ // Notification
Notification notification(type,
extension_->url(),
title,
@@ -345,7 +343,7 @@ bool NotificationsApiFunction::CreateNotification(
optional_fields,
api_delegate);
- g_browser_process->notification_ui_manager()->Add(notification, profile());
+ g_browser_process->notification_ui_manager()->Add(notification, GetProfile());
return true;
}
@@ -442,14 +440,14 @@ bool NotificationsApiFunction::UpdateNotification(
if (options->is_clickable.get())
notification->set_clickable(*options->is_clickable);
- g_browser_process->notification_ui_manager()->Update(
- *notification, profile());
+ g_browser_process->notification_ui_manager()->Update(*notification,
+ GetProfile());
return true;
}
bool NotificationsApiFunction::AreExtensionNotificationsAllowed() const {
DesktopNotificationService* service =
- DesktopNotificationServiceFactory::GetForProfile(profile());
+ DesktopNotificationServiceFactory::GetForProfile(GetProfile());
return service->IsNotifierEnabled(message_center::NotifierId(
message_center::NotifierId::APPLICATION, extension_->id()));
}
@@ -593,7 +591,7 @@ bool NotificationsGetAllFunction::RunNotificationsApi() {
g_browser_process->notification_ui_manager();
std::set<std::string> notification_ids =
notification_ui_manager->GetAllIdsByProfileAndSourceOrigin(
- profile_, extension_->url());
+ GetProfile(), extension_->url());
scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index c15f619..e13bd07 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -289,7 +289,7 @@ bool OmniboxSendSuggestionsFunction::RunImpl() {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY,
- content::Source<Profile>(profile_->GetOriginalProfile()),
+ content::Source<Profile>(GetProfile()->GetOriginalProfile()),
content::Details<SendSuggestions::Params>(params.get()));
return true;
@@ -300,12 +300,11 @@ bool OmniboxSetDefaultSuggestionFunction::RunImpl() {
SetDefaultSuggestion::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- if (SetOmniboxDefaultSuggestion(profile(),
- extension_id(),
- params->suggestion)) {
+ if (SetOmniboxDefaultSuggestion(
+ GetProfile(), extension_id(), params->suggestion)) {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED,
- content::Source<Profile>(profile_->GetOriginalProfile()),
+ content::Source<Profile>(GetProfile()->GetOriginalProfile()),
content::NotificationService::NoDetails());
}
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.h b/chrome/browser/extensions/api/omnibox/omnibox_api.h
index ca2d4b6..f5a7de7 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.h
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.h
@@ -13,7 +13,7 @@
#include "base/strings/string16.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_icon_manager.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/common/extensions/api/omnibox.h"
@@ -71,7 +71,7 @@ class ExtensionOmniboxEventRouter {
DISALLOW_COPY_AND_ASSIGN(ExtensionOmniboxEventRouter);
};
-class OmniboxSendSuggestionsFunction : public SyncExtensionFunction {
+class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS)
@@ -144,7 +144,7 @@ class OmniboxAPI : public ProfileKeyedAPI,
template <>
void ProfileKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies();
-class OmniboxSetDefaultSuggestionFunction : public SyncExtensionFunction {
+class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion",
OMNIBOX_SETDEFAULTSUGGESTION)
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
index c40a19e..d520c4f 100644
--- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc
+++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
@@ -189,9 +189,13 @@ WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() {
Browser* browser = NULL;
content::WebContents* web_contents = NULL;
- if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(),
- include_incognito(), &browser, NULL,
- &web_contents, NULL)) {
+ if (!ExtensionTabUtil::GetTabById(params_->details.tab_id,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ NULL,
+ &web_contents,
+ NULL)) {
return NULL;
}
return web_contents;
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.h b/chrome/browser/extensions/api/page_capture/page_capture_api.h
index aa76864..b7619c6 100644
--- a/chrome/browser/extensions/api/page_capture/page_capture_api.h
+++ b/chrome/browser/extensions/api/page_capture/page_capture_api.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/memory/ref_counted.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/page_capture.h"
#include "webkit/common/blob/shareable_file_reference.h"
@@ -22,7 +22,7 @@ class WebContents;
namespace extensions {
-class PageCaptureSaveAsMHTMLFunction : public AsyncExtensionFunction {
+class PageCaptureSaveAsMHTMLFunction : public ChromeAsyncExtensionFunction {
public:
PageCaptureSaveAsMHTMLFunction();
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.cc b/chrome/browser/extensions/api/permissions/permissions_api.cc
index cf23aa0..e5ac3aa 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api.cc
+++ b/chrome/browser/extensions/api/permissions/permissions_api.cc
@@ -54,11 +54,10 @@ bool PermissionsContainsFunction::RunImpl() {
scoped_ptr<Contains::Params> params(Contains::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- scoped_refptr<PermissionSet> permissions =
- helpers::UnpackPermissionSet(
- params->permissions,
- ExtensionPrefs::Get(profile_)->AllowFileAccess(extension_->id()),
- &error_);
+ scoped_refptr<PermissionSet> permissions = helpers::UnpackPermissionSet(
+ params->permissions,
+ ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
+ &error_);
if (!permissions.get())
return false;
@@ -78,11 +77,10 @@ bool PermissionsRemoveFunction::RunImpl() {
scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- scoped_refptr<PermissionSet> permissions =
- helpers::UnpackPermissionSet(
- params->permissions,
- ExtensionPrefs::Get(profile_)->AllowFileAccess(extension_->id()),
- &error_);
+ scoped_refptr<PermissionSet> permissions = helpers::UnpackPermissionSet(
+ params->permissions,
+ ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
+ &error_);
if (!permissions.get())
return false;
@@ -109,7 +107,8 @@ bool PermissionsRemoveFunction::RunImpl() {
return false;
}
- PermissionsUpdater(profile()).RemovePermissions(extension, permissions.get());
+ PermissionsUpdater(GetProfile())
+ .RemovePermissions(extension, permissions.get());
results_ = Remove::Results::Create(true);
return true;
}
@@ -128,7 +127,7 @@ void PermissionsRequestFunction::SetIgnoreUserGestureForTests(
PermissionsRequestFunction::PermissionsRequestFunction() {}
void PermissionsRequestFunction::InstallUIProceed() {
- PermissionsUpdater perms_updater(profile());
+ PermissionsUpdater perms_updater(GetProfile());
perms_updater.AddPermissions(GetExtension(), requested_permissions_.get());
results_ = Request::Results::Create(true);
@@ -158,11 +157,10 @@ bool PermissionsRequestFunction::RunImpl() {
scoped_ptr<Request::Params> params(Request::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- requested_permissions_ =
- helpers::UnpackPermissionSet(
- params->permissions,
- ExtensionPrefs::Get(profile_)->AllowFileAccess(extension_->id()),
- &error_);
+ requested_permissions_ = helpers::UnpackPermissionSet(
+ params->permissions,
+ ExtensionPrefs::Get(GetProfile())->AllowFileAccess(extension_->id()),
+ &error_);
if (!requested_permissions_.get())
return false;
@@ -186,11 +184,10 @@ bool PermissionsRequestFunction::RunImpl() {
// We don't need to prompt the user if the requested permissions are a subset
// of the granted permissions set.
- scoped_refptr<const PermissionSet> granted =
- ExtensionPrefs::Get(profile_)->
- GetGrantedPermissions(GetExtension()->id());
+ scoped_refptr<const PermissionSet> granted = ExtensionPrefs::Get(
+ GetProfile())->GetGrantedPermissions(GetExtension()->id());
if (granted.get() && granted->Contains(*requested_permissions_.get())) {
- PermissionsUpdater perms_updater(profile());
+ PermissionsUpdater perms_updater(GetProfile());
perms_updater.AddPermissions(GetExtension(), requested_permissions_.get());
results_ = Request::Results::Create(true);
SendResponse(true);
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.h b/chrome/browser/extensions/api/permissions/permissions_api.h
index a0d6ccb..8834587 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api.h
+++ b/chrome/browser/extensions/api/permissions/permissions_api.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/compiler_specific.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/common/extensions/permissions/permission_set.h"
@@ -17,7 +17,7 @@ class ExtensionService;
namespace extensions {
// chrome.permissions.contains
-class PermissionsContainsFunction : public SyncExtensionFunction {
+class PermissionsContainsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.contains", PERMISSIONS_CONTAINS)
@@ -29,7 +29,7 @@ class PermissionsContainsFunction : public SyncExtensionFunction {
};
// chrome.permissions.getAll
-class PermissionsGetAllFunction : public SyncExtensionFunction {
+class PermissionsGetAllFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.getAll", PERMISSIONS_GETALL)
@@ -41,7 +41,7 @@ class PermissionsGetAllFunction : public SyncExtensionFunction {
};
// chrome.permissions.remove
-class PermissionsRemoveFunction : public SyncExtensionFunction {
+class PermissionsRemoveFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("permissions.remove", PERMISSIONS_REMOVE)
@@ -53,7 +53,7 @@ class PermissionsRemoveFunction : public SyncExtensionFunction {
};
// chrome.permissions.request
-class PermissionsRequestFunction : public AsyncExtensionFunction,
+class PermissionsRequestFunction : public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("permissions.request", PERMISSIONS_REQUEST)
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting.cc b/chrome/browser/extensions/api/preference/chrome_direct_setting.cc
index 6d1bd76..bcd13a5 100644
--- a/chrome/browser/extensions/api/preference/chrome_direct_setting.cc
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting.cc
@@ -20,7 +20,7 @@ DirectSettingFunctionBase::DirectSettingFunctionBase() {}
DirectSettingFunctionBase::~DirectSettingFunctionBase() {}
PrefService* DirectSettingFunctionBase::GetPrefService() {
- return profile()->GetPrefs();
+ return GetProfile()->GetPrefs();
}
bool DirectSettingFunctionBase::IsCalledFromComponentExtension() {
@@ -34,8 +34,8 @@ bool GetDirectSettingFunction::RunImpl() {
std::string pref_key;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key));
- EXTENSION_FUNCTION_VALIDATE(
- ChromeDirectSettingAPI::Get(profile())->IsPreferenceOnWhitelist(pref_key));
+ EXTENSION_FUNCTION_VALIDATE(ChromeDirectSettingAPI::Get(GetProfile())
+ ->IsPreferenceOnWhitelist(pref_key));
const PrefService::Preference* preference =
GetPrefService()->FindPreference(pref_key.c_str());
@@ -58,8 +58,8 @@ bool SetDirectSettingFunction::RunImpl() {
std::string pref_key;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key));
- EXTENSION_FUNCTION_VALIDATE(
- ChromeDirectSettingAPI::Get(profile())->IsPreferenceOnWhitelist(pref_key));
+ EXTENSION_FUNCTION_VALIDATE(ChromeDirectSettingAPI::Get(GetProfile())
+ ->IsPreferenceOnWhitelist(pref_key));
DictionaryValue* details = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details));
@@ -89,8 +89,8 @@ bool ClearDirectSettingFunction::RunImpl() {
std::string pref_key;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key));
- EXTENSION_FUNCTION_VALIDATE(
- ChromeDirectSettingAPI::Get(profile())->IsPreferenceOnWhitelist(pref_key));
+ EXTENSION_FUNCTION_VALIDATE(ChromeDirectSettingAPI::Get(GetProfile())
+ ->IsPreferenceOnWhitelist(pref_key));
GetPrefService()->ClearPref(pref_key.c_str());
return true;
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting.h b/chrome/browser/extensions/api/preference/chrome_direct_setting.h
index 7e36344..504bc66 100644
--- a/chrome/browser/extensions/api/preference/chrome_direct_setting.h
+++ b/chrome/browser/extensions/api/preference/chrome_direct_setting.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
#include "base/lazy_instance.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
class PrefService;
@@ -14,7 +14,7 @@ namespace extensions {
namespace chromedirectsetting {
// Base class to host instance method helpers.
-class DirectSettingFunctionBase : public SyncExtensionFunction {
+class DirectSettingFunctionBase : public ChromeSyncExtensionFunction {
protected:
DirectSettingFunctionBase();
virtual ~DirectSettingFunctionBase();
diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc
index 5f12e5d..9711adf 100644
--- a/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chrome/browser/extensions/api/preference/preference_api.cc
@@ -570,8 +570,8 @@ bool GetPreferenceFunction::RunImpl() {
std::string browser_pref;
if (!ValidateBrowserPref(pref_key, &browser_pref))
return false;
- PrefService* prefs = incognito ? profile_->GetOffTheRecordPrefs()
- : profile_->GetPrefs();
+ PrefService* prefs = incognito ? GetProfile()->GetOffTheRecordPrefs()
+ : GetProfile()->GetPrefs();
const PrefService::Preference* pref =
prefs->FindPreference(browser_pref.c_str());
CHECK(pref);
@@ -579,9 +579,8 @@ bool GetPreferenceFunction::RunImpl() {
scoped_ptr<DictionaryValue> result(new DictionaryValue);
// Retrieve level of control.
- std::string level_of_control =
- helpers::GetLevelOfControl(profile_, extension_id(), browser_pref,
- incognito);
+ std::string level_of_control = helpers::GetLevelOfControl(
+ GetProfile(), extension_id(), browser_pref, incognito);
result->SetString(keys::kLevelOfControl, level_of_control);
// Retrieve pref value.
@@ -599,7 +598,7 @@ bool GetPreferenceFunction::RunImpl() {
// Retrieve incognito status.
if (incognito) {
- ExtensionPrefs* ep = ExtensionPrefs::Get(profile_);
+ ExtensionPrefs* ep = ExtensionPrefs::Get(GetProfile());
result->SetBoolean(keys::kIncognitoSpecific,
ep->HasIncognitoPrefValue(browser_pref));
}
@@ -634,21 +633,21 @@ bool SetPreferenceFunction::RunImpl() {
scope == kExtensionPrefsScopeIncognitoSessionOnly);
if (incognito) {
// Regular profiles can't access incognito unless include_incognito is true.
- if (!profile()->IsOffTheRecord() && !include_incognito()) {
+ if (!GetProfile()->IsOffTheRecord() && !include_incognito()) {
error_ = keys::kIncognitoErrorMessage;
return false;
}
} else {
// Incognito profiles can't access regular mode ever, they only exist in
// split mode.
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = "Can't modify regular settings from an incognito context.";
return false;
}
}
if (scope == kExtensionPrefsScopeIncognitoSessionOnly &&
- !profile_->HasOffTheRecordProfile()) {
+ !GetProfile()->HasOffTheRecordProfile()) {
error_ = keys::kIncognitoSessionOnlyErrorMessage;
return false;
}
@@ -657,7 +656,7 @@ bool SetPreferenceFunction::RunImpl() {
std::string browser_pref;
if (!ValidateBrowserPref(pref_key, &browser_pref))
return false;
- ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(GetProfile());
const PrefService::Preference* pref =
prefs->pref_service()->FindPreference(browser_pref.c_str());
CHECK(pref);
@@ -687,11 +686,8 @@ bool SetPreferenceFunction::RunImpl() {
return false;
}
- PreferenceAPI::Get(profile())->SetExtensionControlledPref(
- extension_id(),
- browser_pref,
- scope,
- browser_pref_value.release());
+ PreferenceAPI::Get(GetProfile())->SetExtensionControlledPref(
+ extension_id(), browser_pref, scope, browser_pref_value.release());
return true;
}
@@ -722,7 +718,7 @@ bool ClearPreferenceFunction::RunImpl() {
} else {
// Incognito profiles can't access regular mode ever, they only exist in
// split mode.
- if (profile()->IsOffTheRecord()) {
+ if (GetProfile()->IsOffTheRecord()) {
error_ = "Can't modify regular settings from an incognito context.";
return false;
}
@@ -732,8 +728,8 @@ bool ClearPreferenceFunction::RunImpl() {
if (!ValidateBrowserPref(pref_key, &browser_pref))
return false;
- PreferenceAPI::Get(profile())->RemoveExtensionControlledPref(
- extension_id(), browser_pref, scope);
+ PreferenceAPI::Get(GetProfile())
+ ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope);
return true;
}
diff --git a/chrome/browser/extensions/api/preference/preference_api.h b/chrome/browser/extensions/api/preference/preference_api.h
index e706b57..b924126 100644
--- a/chrome/browser/extensions/api/preference/preference_api.h
+++ b/chrome/browser/extensions/api/preference/preference_api.h
@@ -10,8 +10,8 @@
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "content/public/browser/notification_observer.h"
#include "extensions/browser/extension_prefs_scope.h"
@@ -175,7 +175,7 @@ class PrefTransformerInterface {
// A base class to provide functionality common to the other *PreferenceFunction
// classes.
-class PreferenceFunction : public SyncExtensionFunction {
+class PreferenceFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~PreferenceFunction();
diff --git a/chrome/browser/extensions/api/principals_private/principals_private_api.h b/chrome/browser/extensions/api/principals_private/principals_private_api.h
index bf1bdaa..78f5981 100644
--- a/chrome/browser/extensions/api/principals_private/principals_private_api.h
+++ b/chrome/browser/extensions/api/principals_private/principals_private_api.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_PRINCIPALS_PRIVATE_PRINCIPALS_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_PRINCIPALS_PRIVATE_PRINCIPALS_PRIVATE_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
// WARNING: chrome.principalsPrivate is a set of experimental APIs for the new
// profile management flows. Every new API must extend
@@ -14,7 +14,7 @@
namespace extensions {
-class PrincipalsPrivateExtensionFunction : public SyncExtensionFunction {
+class PrincipalsPrivateExtensionFunction : public ChromeSyncExtensionFunction {
public:
PrincipalsPrivateExtensionFunction() {}
diff --git a/chrome/browser/extensions/api/processes/processes_api.cc b/chrome/browser/extensions/api/processes/processes_api.cc
index d1032f6..42a4ab9 100644
--- a/chrome/browser/extensions/api/processes/processes_api.cc
+++ b/chrome/browser/extensions/api/processes/processes_api.cc
@@ -551,16 +551,18 @@ bool GetProcessIdForTabFunction::RunImpl() {
// which will invoke the callback once we have returned from this function.
// Otherwise, wait for the notification that the task manager is done with
// the data gathering.
- if (ProcessesAPI::Get(profile_)->processes_event_router()->
- is_task_manager_listening()) {
+ if (ProcessesAPI::Get(GetProfile())
+ ->processes_event_router()
+ ->is_task_manager_listening()) {
base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
&GetProcessIdForTabFunction::GetProcessIdForTab, this));
} else {
TaskManager::GetInstance()->model()->RegisterOnDataReadyCallback(
base::Bind(&GetProcessIdForTabFunction::GetProcessIdForTab, this));
- ProcessesAPI::Get(profile_)->processes_event_router()->
- StartTaskManagerListening();
+ ProcessesAPI::Get(GetProfile())
+ ->processes_event_router()
+ ->StartTaskManagerListening();
}
return true;
@@ -573,8 +575,13 @@ bool GetProcessIdForTabFunction::RunImpl() {
void GetProcessIdForTabFunction::GetProcessIdForTab() {
content::WebContents* contents = NULL;
int tab_index = -1;
- if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(),
- NULL, NULL, &contents, &tab_index)) {
+ if (!ExtensionTabUtil::GetTabById(tab_id_,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ NULL,
+ &contents,
+ &tab_index)) {
error_ = ErrorUtils::FormatErrorMessage(
extensions::tabs_constants::kTabNotFoundError,
base::IntToString(tab_id_));
@@ -605,16 +612,18 @@ bool TerminateFunction::RunImpl() {
// which will invoke the callback once we have returned from this function.
// Otherwise, wait for the notification that the task manager is done with
// the data gathering.
- if (ProcessesAPI::Get(profile_)->processes_event_router()->
- is_task_manager_listening()) {
+ if (ProcessesAPI::Get(GetProfile())
+ ->processes_event_router()
+ ->is_task_manager_listening()) {
base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
&TerminateFunction::TerminateProcess, this));
} else {
TaskManager::GetInstance()->model()->RegisterOnDataReadyCallback(
base::Bind(&TerminateFunction::TerminateProcess, this));
- ProcessesAPI::Get(profile_)->processes_event_router()->
- StartTaskManagerListening();
+ ProcessesAPI::Get(GetProfile())
+ ->processes_event_router()
+ ->StartTaskManagerListening();
}
return true;
@@ -685,16 +694,18 @@ bool GetProcessInfoFunction::RunImpl() {
// which will invoke the callback once we have returned from this function.
// Otherwise, wait for the notification that the task manager is done with
// the data gathering.
- if (ProcessesAPI::Get(profile_)->processes_event_router()->
- is_task_manager_listening()) {
+ if (ProcessesAPI::Get(GetProfile())
+ ->processes_event_router()
+ ->is_task_manager_listening()) {
base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
&GetProcessInfoFunction::GatherProcessInfo, this));
} else {
TaskManager::GetInstance()->model()->RegisterOnDataReadyCallback(
base::Bind(&GetProcessInfoFunction::GatherProcessInfo, this));
- ProcessesAPI::Get(profile_)->processes_event_router()->
- StartTaskManagerListening();
+ ProcessesAPI::Get(GetProfile())
+ ->processes_event_router()
+ ->StartTaskManagerListening();
}
return true;
diff --git a/chrome/browser/extensions/api/processes/processes_api.h b/chrome/browser/extensions/api/processes/processes_api.h
index 21cabad..85455f9 100644
--- a/chrome/browser/extensions/api/processes/processes_api.h
+++ b/chrome/browser/extensions/api/processes/processes_api.h
@@ -10,8 +10,8 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/task_manager/task_manager.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "content/public/browser/notification_registrar.h"
@@ -131,7 +131,7 @@ class ProcessesAPI : public ProfileKeyedAPI,
// This extension function returns the Process object for the renderer process
// currently in use by the specified Tab.
-class GetProcessIdForTabFunction : public AsyncExtensionFunction {
+class GetProcessIdForTabFunction : public ChromeAsyncExtensionFunction {
public:
GetProcessIdForTabFunction();
@@ -153,7 +153,7 @@ class GetProcessIdForTabFunction : public AsyncExtensionFunction {
// Using unique IDs instead of OS process IDs allows two advantages:
// * guaranteed uniqueness, since OS process IDs can be reused
// * guards against killing non-Chrome processes
-class TerminateFunction : public AsyncExtensionFunction {
+class TerminateFunction : public ChromeAsyncExtensionFunction {
public:
TerminateFunction();
@@ -173,7 +173,7 @@ class TerminateFunction : public AsyncExtensionFunction {
// Extension function which returns a set of Process objects, containing the
// details corresponding to the process IDs supplied as input.
-class GetProcessInfoFunction : public AsyncExtensionFunction {
+class GetProcessInfoFunction : public ChromeAsyncExtensionFunction {
public:
GetProcessInfoFunction();
diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc b/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc
index 0d5d6bf..34df716 100644
--- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc
+++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.cc
@@ -102,9 +102,9 @@ bool PushMessagingGetChannelIdFunction::RunImpl() {
if (!IsUserLoggedIn()) {
if (interactive_) {
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile())
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile())
->AddObserver(this);
- LoginUIServiceFactory::GetForProfile(profile())->ShowLoginPopup();
+ LoginUIServiceFactory::GetForProfile(GetProfile())->ShowLoginPopup();
return true;
} else {
error_ = kUserNotSignedIn;
@@ -113,7 +113,7 @@ bool PushMessagingGetChannelIdFunction::RunImpl() {
}
}
- DVLOG(2) << "Logged in profile name: " << profile()->GetProfileName();
+ DVLOG(2) << "Logged in profile name: " << GetProfile()->GetProfileName();
StartAccessTokenFetch();
return true;
@@ -124,16 +124,16 @@ void PushMessagingGetChannelIdFunction::StartAccessTokenFetch() {
extensions::ObfuscatedGaiaIdFetcher::GetScopes();
OAuth2TokenService::ScopeSet scopes(scope_vector.begin(), scope_vector.end());
ProfileOAuth2TokenService* token_service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
fetcher_access_token_request_ = token_service->StartRequest(
token_service->GetPrimaryAccountId(), scopes, this);
}
void PushMessagingGetChannelIdFunction::OnRefreshTokenAvailable(
const std::string& account_id) {
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile())
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile())
->RemoveObserver(this);
- DVLOG(2) << "Newly logged in: " << profile()->GetProfileName();
+ DVLOG(2) << "Newly logged in: " << GetProfile()->GetProfileName();
StartAccessTokenFetch();
}
@@ -166,12 +166,12 @@ void PushMessagingGetChannelIdFunction::StartGaiaIdFetch(
const std::string& access_token) {
// Start the async fetch of the Gaia Id.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- net::URLRequestContextGetter* context = profile()->GetRequestContext();
+ net::URLRequestContextGetter* context = GetProfile()->GetRequestContext();
fetcher_.reset(new ObfuscatedGaiaIdFetcher(context, this, access_token));
// Get the token cache and see if we have already cached a Gaia Id.
TokenCacheService* token_cache =
- TokenCacheServiceFactory::GetForProfile(profile());
+ TokenCacheServiceFactory::GetForProfile(GetProfile());
// Check the cache, if we already have a Gaia ID, use it instead of
// fetching the ID over the network.
@@ -188,7 +188,7 @@ void PushMessagingGetChannelIdFunction::StartGaiaIdFetch(
// Check if the user is logged in.
bool PushMessagingGetChannelIdFunction::IsUserLoggedIn() const {
ProfileOAuth2TokenService* token_service =
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
return token_service->RefreshTokenIsAvailable(
token_service->GetPrimaryAccountId());
}
@@ -205,7 +205,7 @@ void PushMessagingGetChannelIdFunction::ReportResult(
base::TimeDelta timeout =
base::TimeDelta::FromDays(kObfuscatedGaiaIdTimeoutInDays);
TokenCacheService* token_cache =
- TokenCacheServiceFactory::GetForProfile(profile());
+ TokenCacheServiceFactory::GetForProfile(GetProfile());
token_cache->StoreToken(GaiaConstants::kObfuscatedGaiaId, gaia_id,
timeout);
}
@@ -260,7 +260,7 @@ void PushMessagingGetChannelIdFunction::OnObfuscatedGaiaIdFetchFailure(
case GoogleServiceAuthError::ACCOUNT_DISABLED: {
if (interactive_) {
LoginUIService* login_ui_service =
- LoginUIServiceFactory::GetForProfile(profile());
+ LoginUIServiceFactory::GetForProfile(GetProfile());
// content::NotificationObserver will be called if token is issued.
login_ui_service->ShowLoginPopup();
} else {
diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h
index d1f0a0c..60c66a0 100644
--- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h
+++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h
@@ -14,7 +14,7 @@
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetcher.h"
#include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler_delegate.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -52,7 +52,7 @@ class PushMessagingEventRouter
};
class PushMessagingGetChannelIdFunction
- : public AsyncExtensionFunction,
+ : public ChromeAsyncExtensionFunction,
public ObfuscatedGaiaIdFetcher::Delegate,
public OAuth2TokenService::Observer,
public OAuth2TokenService::Consumer {
diff --git a/chrome/browser/extensions/api/runtime/runtime_api.cc b/chrome/browser/extensions/api/runtime/runtime_api.cc
index 1af8642..a6670c0 100644
--- a/chrome/browser/extensions/api/runtime/runtime_api.cc
+++ b/chrome/browser/extensions/api/runtime/runtime_api.cc
@@ -238,14 +238,15 @@ void RuntimeEventRouter::OnExtensionUninstalled(
}
bool RuntimeGetBackgroundPageFunction::RunImpl() {
- ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
ExtensionHost* host = system->process_manager()->
GetBackgroundHostForExtension(extension_id());
- if (system->lazy_background_task_queue()->ShouldEnqueueTask(
- profile(), GetExtension())) {
+ if (system->lazy_background_task_queue()->ShouldEnqueueTask(GetProfile(),
+ GetExtension())) {
system->lazy_background_task_queue()->AddPendingTask(
- profile(), extension_id(),
- base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, this));
+ GetProfile(),
+ extension_id(),
+ base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, this));
} else if (host) {
OnPageLoaded(host);
} else {
@@ -275,7 +276,8 @@ bool RuntimeSetUninstallUrlFunction::RunImpl() {
return false;
}
- SetUninstallUrl(ExtensionPrefs::Get(profile()), extension_id(), url_string);
+ SetUninstallUrl(
+ ExtensionPrefs::Get(GetProfile()), extension_id(), url_string);
return true;
}
@@ -283,9 +285,10 @@ bool RuntimeReloadFunction::RunImpl() {
// We can't call ReloadExtension directly, since when this method finishes
// it tries to decrease the reference count for the extension, which fails
// if the extension has already been reloaded; so instead we post a task.
- base::MessageLoop::current()->PostTask(FROM_HERE,
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
base::Bind(&ExtensionService::ReloadExtension,
- profile()->GetExtensionService()->AsWeakPtr(),
+ GetProfile()->GetExtensionService()->AsWeakPtr(),
extension_id()));
return true;
}
@@ -296,7 +299,7 @@ RuntimeRequestUpdateCheckFunction::RuntimeRequestUpdateCheckFunction() {
}
bool RuntimeRequestUpdateCheckFunction::RunImpl() {
- ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
ExtensionService* service = system->extension_service();
ExtensionUpdater* updater = service->updater();
if (!updater) {
@@ -324,7 +327,7 @@ void RuntimeRequestUpdateCheckFunction::CheckComplete() {
// that no update is found, but a previous update check might have already
// queued up an update, so check for that here to make sure we return the
// right value.
- ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
ExtensionService* service = system->extension_service();
const Extension* update = service->GetPendingExtensionUpdate(extension_id());
if (update) {
diff --git a/chrome/browser/extensions/api/runtime/runtime_api.h b/chrome/browser/extensions/api/runtime/runtime_api.h
index 10f35f2..b917ba4 100644
--- a/chrome/browser/extensions/api/runtime/runtime_api.h
+++ b/chrome/browser/extensions/api/runtime/runtime_api.h
@@ -7,7 +7,7 @@
#include <string>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/runtime.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -54,7 +54,7 @@ class RuntimeEventRouter {
const std::string& extension_id);
};
-class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction {
+class RuntimeGetBackgroundPageFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage",
RUNTIME_GETBACKGROUNDPAGE)
@@ -67,7 +67,7 @@ class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction {
void OnPageLoaded(ExtensionHost*);
};
-class RuntimeSetUninstallUrlFunction : public SyncExtensionFunction {
+class RuntimeSetUninstallUrlFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("runtime.setUninstallUrl",
RUNTIME_SETUNINSTALLURL)
@@ -77,7 +77,7 @@ class RuntimeSetUninstallUrlFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class RuntimeReloadFunction : public SyncExtensionFunction {
+class RuntimeReloadFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("runtime.reload", RUNTIME_RELOAD)
@@ -86,7 +86,7 @@ class RuntimeReloadFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class RuntimeRequestUpdateCheckFunction : public AsyncExtensionFunction,
+class RuntimeRequestUpdateCheckFunction : public ChromeAsyncExtensionFunction,
public content::NotificationObserver {
public:
DECLARE_EXTENSION_FUNCTION("runtime.requestUpdateCheck",
@@ -109,7 +109,7 @@ class RuntimeRequestUpdateCheckFunction : public AsyncExtensionFunction,
bool did_reply_;
};
-class RuntimeRestartFunction : public SyncExtensionFunction {
+class RuntimeRestartFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("runtime.restart", RUNTIME_RESTART)
@@ -118,7 +118,7 @@ class RuntimeRestartFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class RuntimeGetPlatformInfoFunction : public SyncExtensionFunction {
+class RuntimeGetPlatformInfoFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo",
RUNTIME_GETPLATFORMINFO);
@@ -127,7 +127,8 @@ class RuntimeGetPlatformInfoFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class RuntimeGetPackageDirectoryEntryFunction : public SyncExtensionFunction {
+class RuntimeGetPackageDirectoryEntryFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("runtime.getPackageDirectoryEntry",
RUNTIME_GETPACKAGEDIRECTORYENTRY)
diff --git a/chrome/browser/extensions/api/serial/serial_api.cc b/chrome/browser/extensions/api/serial/serial_api.cc
index 3f33da4..a15f7e1 100644
--- a/chrome/browser/extensions/api/serial/serial_api.cc
+++ b/chrome/browser/extensions/api/serial/serial_api.cc
@@ -41,7 +41,7 @@ SerialAsyncApiFunction::~SerialAsyncApiFunction() {
}
bool SerialAsyncApiFunction::PrePrepare() {
- manager_ = ApiResourceManager<SerialConnection>::Get(profile());
+ manager_ = ApiResourceManager<SerialConnection>::Get(GetProfile());
DCHECK(manager_);
return true;
}
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc
index 7115dcb..013afa3 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.cc
+++ b/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -141,7 +141,7 @@ bool is_window_entry(const TabRestoreService::Entry* entry) {
scoped_ptr<tabs::Tab> SessionsGetRecentlyClosedFunction::CreateTabModel(
const TabRestoreService::Tab& tab, int session_id, int selected_index) {
- return CreateTabModelHelper(profile(),
+ return CreateTabModelHelper(GetProfile(),
tab.navigations[tab.current_navigation_index],
base::IntToString(session_id),
tab.tabstrip_index,
@@ -204,7 +204,7 @@ bool SessionsGetRecentlyClosedFunction::RunImpl() {
std::vector<linked_ptr<api::sessions::Session> > result;
TabRestoreService* tab_restore_service =
- TabRestoreServiceFactory::GetForProfile(profile());
+ TabRestoreServiceFactory::GetForProfile(GetProfile());
DCHECK(tab_restore_service);
// List of entries. They are ordered from most to least recent.
@@ -228,7 +228,7 @@ scoped_ptr<tabs::Tab> SessionsGetDevicesFunction::CreateTabModel(
int tab_index,
int selected_index) {
std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString();
- return CreateTabModelHelper(profile(),
+ return CreateTabModelHelper(GetProfile(),
tab.navigations[tab.current_navigation_index],
session_id,
tab_index,
@@ -250,7 +250,7 @@ scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
continue;
const sessions::SerializedNavigationEntry& current_navigation =
tab->navigations.at(tab->normalized_navigation_index());
- if (chrome::IsNTPURL(current_navigation.virtual_url(), profile())) {
+ if (chrome::IsNTPURL(current_navigation.virtual_url(), GetProfile())) {
continue;
}
tabs_in_window.push_back(tab);
@@ -351,7 +351,7 @@ scoped_ptr<api::sessions::Device> SessionsGetDevicesFunction::CreateDeviceModel(
bool SessionsGetDevicesFunction::RunImpl() {
ProfileSyncService* service =
- ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile());
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile());
if (!(service && service->GetPreferredDataTypes().Has(syncer::SESSIONS))) {
// Sync not enabled.
results_ = GetDevices::Results::Create(
@@ -419,7 +419,7 @@ bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) {
bool SessionsRestoreFunction::RestoreMostRecentlyClosed(Browser* browser) {
TabRestoreService* tab_restore_service =
- TabRestoreServiceFactory::GetForProfile(profile());
+ TabRestoreServiceFactory::GetForProfile(GetProfile());
chrome::HostDesktopType host_desktop_type = browser->host_desktop_type();
TabRestoreService::Entries entries = tab_restore_service->entries();
@@ -448,7 +448,7 @@ bool SessionsRestoreFunction::RestoreMostRecentlyClosed(Browser* browser) {
bool SessionsRestoreFunction::RestoreLocalSession(const SessionId& session_id,
Browser* browser) {
TabRestoreService* tab_restore_service =
- TabRestoreServiceFactory::GetForProfile(profile());
+ TabRestoreServiceFactory::GetForProfile(GetProfile());
chrome::HostDesktopType host_desktop_type = browser->host_desktop_type();
TabRestoreService::Entries entries = tab_restore_service->entries();
@@ -496,7 +496,7 @@ bool SessionsRestoreFunction::RestoreLocalSession(const SessionId& session_id,
bool SessionsRestoreFunction::RestoreForeignSession(const SessionId& session_id,
Browser* browser) {
ProfileSyncService* service =
- ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile());
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile());
if (!(service && service->GetPreferredDataTypes().Has(syncer::SESSIONS))) {
SetError(kSessionSyncError);
return false;
@@ -541,9 +541,8 @@ bool SessionsRestoreFunction::RestoreForeignSession(const SessionId& session_id,
chrome::HostDesktopType host_desktop_type = browser->host_desktop_type();
// Only restore one window at a time.
- std::vector<Browser*> browsers =
- SessionRestore::RestoreForeignSessionWindows(profile(), host_desktop_type,
- window, window + 1);
+ std::vector<Browser*> browsers = SessionRestore::RestoreForeignSessionWindows(
+ GetProfile(), host_desktop_type, window, window + 1);
// Will always create one browser because we only restore one window per call.
DCHECK_EQ(1u, browsers.size());
return SetResultRestoredWindow(ExtensionTabUtil::GetWindowId(browsers[0]));
@@ -553,9 +552,8 @@ bool SessionsRestoreFunction::RunImpl() {
scoped_ptr<Restore::Params> params(Restore::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- Browser* browser =
- chrome::FindBrowserWithProfile(profile(),
- chrome::HOST_DESKTOP_TYPE_NATIVE);
+ Browser* browser = chrome::FindBrowserWithProfile(
+ GetProfile(), chrome::HOST_DESKTOP_TYPE_NATIVE);
if (!browser) {
SetError(kNoBrowserToRestoreSession);
return false;
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.h b/chrome/browser/extensions/api/sessions/sessions_api.h
index 0498b69..c7d9149 100644
--- a/chrome/browser/extensions/api/sessions/sessions_api.h
+++ b/chrome/browser/extensions/api/sessions/sessions_api.h
@@ -8,7 +8,7 @@
#include <string>
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_observer.h"
#include "chrome/common/extensions/api/sessions.h"
@@ -25,7 +25,7 @@ namespace extensions {
class SessionId;
-class SessionsGetRecentlyClosedFunction : public SyncExtensionFunction {
+class SessionsGetRecentlyClosedFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~SessionsGetRecentlyClosedFunction() {}
virtual bool RunImpl() OVERRIDE;
@@ -43,7 +43,7 @@ class SessionsGetRecentlyClosedFunction : public SyncExtensionFunction {
const TabRestoreService::Entry* entry);
};
-class SessionsGetDevicesFunction : public SyncExtensionFunction {
+class SessionsGetDevicesFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~SessionsGetDevicesFunction() {}
virtual bool RunImpl() OVERRIDE;
@@ -64,7 +64,7 @@ class SessionsGetDevicesFunction : public SyncExtensionFunction {
const browser_sync::SyncedSession* session);
};
-class SessionsRestoreFunction : public SyncExtensionFunction {
+class SessionsRestoreFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~SessionsRestoreFunction() {}
virtual bool RunImpl() OVERRIDE;
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
index 2a2aa0c..9a8f8f2 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
@@ -107,8 +107,8 @@ bool SignedInDevicesGetFunction::RunImpl() {
bool is_local = params->is_local.get() ? *params->is_local : false;
if (is_local) {
- scoped_ptr<DeviceInfo> device = GetLocalDeviceInfo(extension_id(),
- profile());
+ scoped_ptr<DeviceInfo> device =
+ GetLocalDeviceInfo(extension_id(), GetProfile());
base::ListValue* result = new base::ListValue();
if (device.get()) {
result->Append(device->ToValue());
@@ -117,8 +117,8 @@ bool SignedInDevicesGetFunction::RunImpl() {
return true;
}
- ScopedVector<DeviceInfo> devices = GetAllSignedInDevices(extension_id(),
- profile());
+ ScopedVector<DeviceInfo> devices =
+ GetAllSignedInDevices(extension_id(), GetProfile());
scoped_ptr<base::ListValue> result(new base::ListValue());
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h
index f093ba2..c45f3e9 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/memory/scoped_vector.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace browser_sync {
class DeviceInfo;
@@ -37,7 +37,7 @@ ScopedVector<browser_sync::DeviceInfo> GetAllSignedInDevices(
ProfileSyncService* pss,
ExtensionPrefs* extension_prefs);
-class SignedInDevicesGetFunction : public SyncExtensionFunction {
+class SignedInDevicesGetFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~SignedInDevicesGetFunction() {}
diff --git a/chrome/browser/extensions/api/socket/socket_api.cc b/chrome/browser/extensions/api/socket/socket_api.cc
index c59d97a..993d4ca 100644
--- a/chrome/browser/extensions/api/socket/socket_api.cc
+++ b/chrome/browser/extensions/api/socket/socket_api.cc
@@ -55,7 +55,7 @@ SocketAsyncApiFunction::~SocketAsyncApiFunction() {
bool SocketAsyncApiFunction::PrePrepare() {
manager_ = CreateSocketResourceManager();
- return manager_->SetProfile(profile());
+ return manager_->SetProfile(GetProfile());
}
bool SocketAsyncApiFunction::Respond() {
diff --git a/chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.cc b/chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.cc
index a13fbb3..729587f 100644
--- a/chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.cc
+++ b/chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.cc
@@ -158,7 +158,7 @@ bool SocketsTcpSetPausedFunction::Prepare() {
params_ = api::sockets_tcp::SetPaused::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- socket_event_dispatcher_ = TCPSocketEventDispatcher::Get(profile());
+ socket_event_dispatcher_ = TCPSocketEventDispatcher::Get(GetProfile());
DCHECK(socket_event_dispatcher_) << "There is no socket event dispatcher. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
@@ -243,7 +243,7 @@ bool SocketsTcpConnectFunction::Prepare() {
params_ = sockets_tcp::Connect::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- socket_event_dispatcher_ = TCPSocketEventDispatcher::Get(profile());
+ socket_event_dispatcher_ = TCPSocketEventDispatcher::Get(GetProfile());
DCHECK(socket_event_dispatcher_) << "There is no socket event dispatcher. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
diff --git a/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api.cc b/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api.cc
index 0827e29..cace238 100644
--- a/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api.cc
+++ b/chrome/browser/extensions/api/sockets_tcp_server/sockets_tcp_server_api.cc
@@ -129,7 +129,7 @@ bool SocketsTcpServerSetPausedFunction::Prepare() {
params_ = api::sockets_tcp_server::SetPaused::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- socket_event_dispatcher_ = TCPServerSocketEventDispatcher::Get(profile());
+ socket_event_dispatcher_ = TCPServerSocketEventDispatcher::Get(GetProfile());
DCHECK(socket_event_dispatcher_) << "There is no socket event dispatcher. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
@@ -164,7 +164,7 @@ bool SocketsTcpServerListenFunction::Prepare() {
params_ = api::sockets_tcp_server::Listen::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- socket_event_dispatcher_ = TCPServerSocketEventDispatcher::Get(profile());
+ socket_event_dispatcher_ = TCPServerSocketEventDispatcher::Get(GetProfile());
DCHECK(socket_event_dispatcher_) << "There is no socket event dispatcher. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
diff --git a/chrome/browser/extensions/api/sockets_udp/sockets_udp_api.cc b/chrome/browser/extensions/api/sockets_udp/sockets_udp_api.cc
index cc58c62..5939c44 100644
--- a/chrome/browser/extensions/api/sockets_udp/sockets_udp_api.cc
+++ b/chrome/browser/extensions/api/sockets_udp/sockets_udp_api.cc
@@ -140,7 +140,7 @@ bool SocketsUdpBindFunction::Prepare() {
params_ = sockets_udp::Bind::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- socket_event_dispatcher_ = UDPSocketEventDispatcher::Get(profile());
+ socket_event_dispatcher_ = UDPSocketEventDispatcher::Get(GetProfile());
DCHECK(socket_event_dispatcher_) << "There is no socket event dispatcher. "
"If this assertion is failing during a test, then it is likely that "
"TestExtensionSystem is failing to provide an instance of "
diff --git a/chrome/browser/extensions/api/storage/storage_api.cc b/chrome/browser/extensions/api/storage/storage_api.cc
index 3af4a34..e562d91 100644
--- a/chrome/browser/extensions/api/storage/storage_api.cc
+++ b/chrome/browser/extensions/api/storage/storage_api.cc
@@ -49,7 +49,7 @@ bool SettingsFunction::RunImpl() {
settings_namespace_ != settings_namespace::INVALID);
SettingsFrontend* frontend =
- profile()->GetExtensionService()->settings_frontend();
+ GetProfile()->GetExtensionService()->settings_frontend();
if (!frontend->IsStorageEnabled(settings_namespace_)) {
error_ = base::StringPrintf(
"\"%s\" is not available in this instance of Chrome",
diff --git a/chrome/browser/extensions/api/storage/storage_api.h b/chrome/browser/extensions/api/storage/storage_api.h
index b3a5b4e..a37ae6d 100644
--- a/chrome/browser/extensions/api/storage/storage_api.h
+++ b/chrome/browser/extensions/api/storage/storage_api.h
@@ -9,13 +9,13 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/api/storage/settings_namespace.h"
#include "chrome/browser/extensions/api/storage/settings_observer.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/value_store/value_store.h"
namespace extensions {
// Superclass of all settings functions.
-class SettingsFunction : public AsyncExtensionFunction {
+class SettingsFunction : public ChromeAsyncExtensionFunction {
protected:
SettingsFunction();
virtual ~SettingsFunction();
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
index 86f6a94..40219a2 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
@@ -64,9 +64,9 @@ bool SyncFileSystemDeleteFileSystemFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
scoped_refptr<fileapi::FileSystemContext> file_system_context =
- BrowserContext::GetStoragePartition(
- profile(),
- render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ BrowserContext::GetStoragePartition(GetProfile(),
+ render_view_host()->GetSiteInstance())
+ ->GetFileSystemContext();
fileapi::FileSystemURL file_system_url(
file_system_context->CrackURL(GURL(url)));
@@ -111,7 +111,7 @@ bool SyncFileSystemRequestFileSystemFunction::RunImpl() {
// SyncFileSystem initialization is done in OpenFileSystem below, but we call
// GetSyncFileSystemService here too to initialize sync event observer for
// extensions API.
- GetSyncFileSystemService(profile());
+ GetSyncFileSystemService(GetProfile());
// Initializes sync context for this extension and continue to open
// a new file system.
@@ -130,8 +130,8 @@ fileapi::FileSystemContext*
SyncFileSystemRequestFileSystemFunction::GetFileSystemContext() {
DCHECK(render_view_host());
return BrowserContext::GetStoragePartition(
- profile(),
- render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ GetProfile(), render_view_host()->GetSiteInstance())
+ ->GetFileSystemContext();
}
void SyncFileSystemRequestFileSystemFunction::DidOpenFileSystem(
@@ -167,16 +167,15 @@ bool SyncFileSystemGetFileStatusFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
scoped_refptr<fileapi::FileSystemContext> file_system_context =
- BrowserContext::GetStoragePartition(
- profile(),
- render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ BrowserContext::GetStoragePartition(GetProfile(),
+ render_view_host()->GetSiteInstance())
+ ->GetFileSystemContext();
fileapi::FileSystemURL file_system_url(
file_system_context->CrackURL(GURL(url)));
- GetSyncFileSystemService(profile())->GetFileSyncStatus(
+ GetSyncFileSystemService(GetProfile())->GetFileSyncStatus(
file_system_url,
- Bind(&SyncFileSystemGetFileStatusFunction::DidGetFileStatus,
- this));
+ Bind(&SyncFileSystemGetFileStatusFunction::DidGetFileStatus, this));
return true;
}
@@ -208,9 +207,9 @@ bool SyncFileSystemGetFileStatusesFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &file_entry_urls));
scoped_refptr<fileapi::FileSystemContext> file_system_context =
- BrowserContext::GetStoragePartition(
- profile(),
- render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ BrowserContext::GetStoragePartition(GetProfile(),
+ render_view_host()->GetSiteInstance())
+ ->GetFileSystemContext();
// Map each file path->SyncFileStatus in the callback map.
// TODO(calvinlo): Overload GetFileSyncStatus to take in URL array.
@@ -218,7 +217,7 @@ bool SyncFileSystemGetFileStatusesFunction::RunImpl() {
num_results_received_ = 0;
file_sync_statuses_.clear();
sync_file_system::SyncFileSystemService* sync_file_system_service =
- GetSyncFileSystemService(profile());
+ GetSyncFileSystemService(GetProfile());
for (unsigned int i = 0; i < num_expected_results_; i++) {
std::string url;
file_entry_urls->GetString(i, &url);
@@ -285,16 +284,16 @@ bool SyncFileSystemGetUsageAndQuotaFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
scoped_refptr<fileapi::FileSystemContext> file_system_context =
- BrowserContext::GetStoragePartition(
- profile(),
- render_view_host()->GetSiteInstance())->GetFileSystemContext();
+ BrowserContext::GetStoragePartition(GetProfile(),
+ render_view_host()->GetSiteInstance())
+ ->GetFileSystemContext();
fileapi::FileSystemURL file_system_url(
file_system_context->CrackURL(GURL(url)));
scoped_refptr<quota::QuotaManager> quota_manager =
- BrowserContext::GetStoragePartition(
- profile(),
- render_view_host()->GetSiteInstance())->GetQuotaManager();
+ BrowserContext::GetStoragePartition(GetProfile(),
+ render_view_host()->GetSiteInstance())
+ ->GetQuotaManager();
BrowserThread::PostTask(
BrowserThread::IO,
@@ -346,8 +345,8 @@ bool SyncFileSystemSetConflictResolutionPolicyFunction::RunImpl() {
policy_string.c_str()));
return false;
}
- sync_file_system::SyncFileSystemService* service = GetSyncFileSystemService(
- profile());
+ sync_file_system::SyncFileSystemService* service =
+ GetSyncFileSystemService(GetProfile());
DCHECK(service);
SyncStatusCode status = service->SetConflictResolutionPolicy(policy);
if (status != sync_file_system::SYNC_STATUS_OK) {
@@ -358,8 +357,8 @@ bool SyncFileSystemSetConflictResolutionPolicyFunction::RunImpl() {
}
bool SyncFileSystemGetConflictResolutionPolicyFunction::RunImpl() {
- sync_file_system::SyncFileSystemService* service = GetSyncFileSystemService(
- profile());
+ sync_file_system::SyncFileSystemService* service =
+ GetSyncFileSystemService(GetProfile());
DCHECK(service);
api::sync_file_system::ConflictResolutionPolicy policy =
ConflictResolutionPolicyToExtensionEnum(
@@ -370,8 +369,8 @@ bool SyncFileSystemGetConflictResolutionPolicyFunction::RunImpl() {
}
bool SyncFileSystemGetServiceStatusFunction::RunImpl() {
- sync_file_system::SyncFileSystemService* service = GetSyncFileSystemService(
- profile());
+ sync_file_system::SyncFileSystemService* service =
+ GetSyncFileSystemService(GetProfile());
results_ = api::sync_file_system::GetServiceStatus::Results::Create(
SyncServiceStateToExtensionEnum(service->GetSyncServiceState()));
return true;
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
index c3f7680..92aed63 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
@@ -8,7 +8,7 @@
#include <map>
#include "base/platform_file.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/sync_file_system/conflict_resolution_policy.h"
#include "chrome/browser/sync_file_system/sync_file_status.h"
#include "chrome/browser/sync_file_system/sync_status_code.h"
@@ -23,7 +23,7 @@ class FileSystemContext;
namespace extensions {
class SyncFileSystemDeleteFileSystemFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
// TODO(kinuko,calvinlo): Uncomment this or delete this class when
// we decide if we want to revive this function.
@@ -38,9 +38,8 @@ class SyncFileSystemDeleteFileSystemFunction
void DidDeleteFileSystem(base::PlatformFileError error);
};
-
class SyncFileSystemGetFileStatusFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.getFileStatus",
SYNCFILESYSTEM_GETFILESYNCSTATUS)
@@ -56,7 +55,7 @@ class SyncFileSystemGetFileStatusFunction
};
class SyncFileSystemGetFileStatusesFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.getFileStatuses",
SYNCFILESYSTEM_GETFILESYNCSTATUSES)
@@ -83,7 +82,7 @@ class SyncFileSystemGetFileStatusesFunction
};
class SyncFileSystemGetUsageAndQuotaFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.getUsageAndQuota",
SYNCFILESYSTEM_GETUSAGEANDQUOTA)
@@ -99,7 +98,7 @@ class SyncFileSystemGetUsageAndQuotaFunction
};
class SyncFileSystemRequestFileSystemFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.requestFileSystem",
SYNCFILESYSTEM_REQUESTFILESYSTEM)
@@ -120,7 +119,7 @@ class SyncFileSystemRequestFileSystemFunction
};
class SyncFileSystemSetConflictResolutionPolicyFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.setConflictResolutionPolicy",
SYNCFILESYSTEM_SETCONFLICTRESOLUTIONPOLICY)
@@ -131,7 +130,7 @@ class SyncFileSystemSetConflictResolutionPolicyFunction
};
class SyncFileSystemGetConflictResolutionPolicyFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.getConflictResolutionPolicy",
SYNCFILESYSTEM_GETCONFLICTRESOLUTIONPOLICY)
@@ -141,7 +140,8 @@ class SyncFileSystemGetConflictResolutionPolicyFunction
virtual bool RunImpl() OVERRIDE;
};
-class SyncFileSystemGetServiceStatusFunction : public SyncExtensionFunction {
+class SyncFileSystemGetServiceStatusFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("syncFileSystem.getServiceStatus",
SYNCFILESYSTEM_GETSERVICESTATUS)
diff --git a/chrome/browser/extensions/api/system_private/system_private_api.cc b/chrome/browser/extensions/api/system_private/system_private_api.cc
index 4a5654b..20e3c37 100644
--- a/chrome/browser/extensions/api/system_private/system_private_api.cc
+++ b/chrome/browser/extensions/api/system_private/system_private_api.cc
@@ -62,7 +62,7 @@ namespace extensions {
namespace system_private = api::system_private;
bool SystemPrivateGetIncognitoModeAvailabilityFunction::RunImpl() {
- PrefService* prefs = profile_->GetPrefs();
+ PrefService* prefs = GetProfile()->GetPrefs();
int value = prefs->GetInteger(prefs::kIncognitoModeAvailability);
EXTENSION_FUNCTION_VALIDATE(
value >= 0 &&
diff --git a/chrome/browser/extensions/api/system_private/system_private_api.h b/chrome/browser/extensions/api/system_private/system_private_api.h
index 06194a8..33f91ba 100644
--- a/chrome/browser/extensions/api/system_private/system_private_api.h
+++ b/chrome/browser/extensions/api/system_private/system_private_api.h
@@ -8,12 +8,12 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_PRIVATE_SYSTEM_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_PRIVATE_SYSTEM_PRIVATE_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
class SystemPrivateGetIncognitoModeAvailabilityFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("systemPrivate.getIncognitoModeAvailability",
SYSTEMPRIVATE_GETINCOGNITOMODEAVAILABILITY)
@@ -26,7 +26,8 @@ class SystemPrivateGetIncognitoModeAvailabilityFunction
};
// API function which returns the status of system update.
-class SystemPrivateGetUpdateStatusFunction : public SyncExtensionFunction {
+class SystemPrivateGetUpdateStatusFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("systemPrivate.getUpdateStatus",
SYSTEMPRIVATE_GETUPDATESTATUS)
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
index 4b3b165..b65ebc4 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -69,9 +69,8 @@ bool TabCaptureCaptureFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(params.get());
// Figure out the active WebContents and retrieve the needed ids.
- Browser* target_browser = chrome::FindAnyBrowser(profile(),
- include_incognito(),
- chrome::GetActiveDesktop());
+ Browser* target_browser = chrome::FindAnyBrowser(
+ GetProfile(), include_incognito(), chrome::GetActiveDesktop());
if (!target_browser) {
error_ = kFindingTabError;
return false;
@@ -145,7 +144,7 @@ bool TabCaptureCaptureFunction::RunImpl() {
}
extensions::TabCaptureRegistry* registry =
- extensions::TabCaptureRegistry::Get(profile());
+ extensions::TabCaptureRegistry::Get(GetProfile());
if (!registry->AddRequest(render_process_id,
routing_id,
extension_id,
@@ -167,7 +166,7 @@ bool TabCaptureCaptureFunction::RunImpl() {
bool TabCaptureGetCapturedTabsFunction::RunImpl() {
extensions::TabCaptureRegistry* registry =
- extensions::TabCaptureRegistry::Get(profile());
+ extensions::TabCaptureRegistry::Get(GetProfile());
const TabCaptureRegistry::RegistryCaptureInfo& captured_tabs =
registry->GetCapturedTabs(GetExtension()->id());
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.h b/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
index 4a708f4..cac9e16 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
@@ -8,13 +8,13 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_API_H_
-#include "chrome/browser/extensions/api/api_function.h"
#include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/tab_capture.h"
namespace extensions {
-class TabCaptureCaptureFunction : public SyncExtensionFunction {
+class TabCaptureCaptureFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("tabCapture.capture", TABCAPTURE_CAPTURE)
@@ -25,7 +25,7 @@ class TabCaptureCaptureFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class TabCaptureGetCapturedTabsFunction : public SyncExtensionFunction {
+class TabCaptureGetCapturedTabsFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("tabCapture.getCapturedTabs",
TABCAPTURE_GETCAPTUREDTABS)
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 2cb3959..c4ba43b 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -148,8 +148,9 @@ Browser* GetBrowserInProfileWithId(Profile* profile,
return NULL;
}
-bool GetBrowserFromWindowID(
- UIThreadExtensionFunction* function, int window_id, Browser** browser) {
+bool GetBrowserFromWindowID(ChromeAsyncExtensionFunction* function,
+ int window_id,
+ Browser** browser) {
if (window_id == extension_misc::kCurrentWindowId) {
*browser = function->GetCurrentBrowser();
if (!(*browser) || !(*browser)->window()) {
@@ -158,8 +159,10 @@ bool GetBrowserFromWindowID(
}
} else {
std::string error;
- *browser = GetBrowserInProfileWithId(
- function->profile(), window_id, function->include_incognito(), &error);
+ *browser = GetBrowserInProfileWithId(function->GetProfile(),
+ window_id,
+ function->include_incognito(),
+ &error);
if (!*browser) {
function->SetError(error);
return false;
@@ -280,7 +283,7 @@ bool WindowsGetLastFocusedFunction::RunImpl() {
// include other window types (e.g. panels), we will need to add logic to
// WindowControllerList that mirrors the active behavior of BrowserList.
Browser* browser = chrome::FindAnyBrowser(
- profile(), include_incognito(), chrome::GetActiveDesktop());
+ GetProfile(), include_incognito(), chrome::GetActiveDesktop());
if (!browser || !browser->window()) {
error_ = keys::kNoLastFocusedWindowError;
return false;
@@ -325,7 +328,7 @@ bool WindowsCreateFunction::ShouldOpenIncognitoWindow(
std::vector<GURL>* urls, bool* is_error) {
*is_error = false;
const IncognitoModePrefs::Availability incognito_availability =
- IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
+ IncognitoModePrefs::GetAvailability(GetProfile()->GetPrefs());
bool incognito = false;
if (create_data && create_data->incognito) {
incognito = *create_data->incognito;
@@ -347,10 +350,10 @@ bool WindowsCreateFunction::ShouldOpenIncognitoWindow(
// Remove all URLs that are not allowed in an incognito session. Note that a
// ChromeOS guest session is not considered incognito in this case.
- if (incognito && !profile_->IsGuestSession()) {
+ if (incognito && !GetProfile()->IsGuestSession()) {
std::string first_url_erased;
for (size_t i = 0; i < urls->size();) {
- if (chrome::IsURLAllowedInIncognito((*urls)[i], profile())) {
+ if (chrome::IsURLAllowedInIncognito((*urls)[i], GetProfile())) {
i++;
} else {
if (first_url_erased.empty())
@@ -409,12 +412,18 @@ bool WindowsCreateFunction::RunImpl() {
if (create_data && create_data->tab_id) {
// Find the tab. |source_tab_strip| and |tab_index| will later be used to
// move the tab into the created window.
- if (!GetTabById(*create_data->tab_id, profile(), include_incognito(), NULL,
- &source_tab_strip, NULL, &tab_index, &error_))
+ if (!GetTabById(*create_data->tab_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ &source_tab_strip,
+ NULL,
+ &tab_index,
+ &error_))
return false;
}
- Profile* window_profile = profile();
+ Profile* window_profile = GetProfile();
Browser::Type window_type = Browser::TYPE_TABBED;
bool create_panel = false;
@@ -867,17 +876,17 @@ bool TabsQueryFunction::RunImpl() {
base::ListValue* result = new base::ListValue();
Browser* last_active_browser = chrome::FindAnyBrowser(
- profile(), include_incognito(), chrome::GetActiveDesktop());
+ GetProfile(), include_incognito(), chrome::GetActiveDesktop());
Browser* current_browser = GetCurrentBrowser();
for (chrome::BrowserIterator it; !it.done(); it.Next()) {
Browser* browser = *it;
- if (!profile()->IsSameProfile(browser->profile()))
+ if (!GetProfile()->IsSameProfile(browser->profile()))
continue;
if (!browser->window())
continue;
- if (!include_incognito() && profile() != browser->profile())
+ if (!include_incognito() && GetProfile() != browser->profile())
continue;
if (window_id >= 0 && window_id != ExtensionTabUtil::GetWindowId(browser))
@@ -960,8 +969,8 @@ bool TabsCreateFunction::RunImpl() {
// Ensure the selected browser is tabbed.
if (!browser->is_type_tabbed() && browser->IsAttemptingToCloseBrowser())
- browser = chrome::FindTabbedBrowser(profile(), include_incognito(),
- browser->host_desktop_type());
+ browser = chrome::FindTabbedBrowser(
+ GetProfile(), include_incognito(), browser->host_desktop_type());
if (!browser || !browser->window())
return false;
@@ -972,9 +981,13 @@ bool TabsCreateFunction::RunImpl() {
if (params->create_properties.opener_tab_id.get()) {
int opener_id = *params->create_properties.opener_tab_id;
- if (!ExtensionTabUtil::GetTabById(
- opener_id, profile(), include_incognito(),
- NULL, NULL, &opener, NULL)) {
+ if (!ExtensionTabUtil::GetTabById(opener_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ NULL,
+ &opener,
+ NULL)) {
return false;
}
}
@@ -1088,8 +1101,14 @@ bool TabsDuplicateFunction::RunImpl() {
Browser* browser = NULL;
TabStripModel* tab_strip = NULL;
int tab_index = -1;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- &browser, &tab_strip, NULL, &tab_index, &error_)) {
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ &tab_strip,
+ NULL,
+ &tab_index,
+ &error_)) {
return false;
}
@@ -1124,8 +1143,14 @@ bool TabsGetFunction::RunImpl() {
TabStripModel* tab_strip = NULL;
WebContents* contents = NULL;
int tab_index = -1;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- NULL, &tab_strip, &contents, &tab_index, &error_))
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ &tab_strip,
+ &contents,
+ &tab_index,
+ &error_))
return false;
SetResult(ExtensionTabUtil::CreateTabValue(contents,
@@ -1240,8 +1265,14 @@ bool TabsUpdateFunction::RunImpl() {
int tab_index = -1;
TabStripModel* tab_strip = NULL;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- NULL, &tab_strip, &contents, &tab_index, &error_)) {
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ &tab_strip,
+ &contents,
+ &tab_index,
+ &error_)) {
return false;
}
@@ -1293,9 +1324,13 @@ bool TabsUpdateFunction::RunImpl() {
int opener_id = *params->update_properties.opener_tab_id;
WebContents* opener_contents = NULL;
- if (!ExtensionTabUtil::GetTabById(
- opener_id, profile(), include_incognito(),
- NULL, NULL, &opener_contents, NULL))
+ if (!ExtensionTabUtil::GetTabById(opener_id,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ NULL,
+ &opener_contents,
+ NULL))
return false;
tab_strip->SetOpenerOfWebContentsAt(tab_index, opener_contents);
@@ -1439,9 +1474,14 @@ bool TabsMoveFunction::MoveTab(int tab_id,
TabStripModel* source_tab_strip = NULL;
WebContents* contents = NULL;
int tab_index = -1;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- &source_browser, &source_tab_strip, &contents,
- &tab_index, &error_)) {
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ &source_browser,
+ &source_tab_strip,
+ &contents,
+ &tab_index,
+ &error_)) {
return false;
}
@@ -1554,8 +1594,14 @@ bool TabsReloadFunction::RunImpl() {
int tab_id = *params->tab_id;
Browser* browser = NULL;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- &browser, NULL, &web_contents, NULL, &error_))
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ NULL,
+ &web_contents,
+ NULL,
+ &error_))
return false;
}
@@ -1595,8 +1641,14 @@ bool TabsRemoveFunction::RunImpl() {
bool TabsRemoveFunction::RemoveTab(int tab_id) {
Browser* browser = NULL;
WebContents* contents = NULL;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- &browser, NULL, &contents, NULL, &error_)) {
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ NULL,
+ &contents,
+ NULL,
+ &error_)) {
return false;
}
@@ -1643,7 +1695,7 @@ bool TabsCaptureVisibleTabFunction::RunImpl() {
tabs::CaptureVisibleTab::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- PrefService* service = profile()->GetPrefs();
+ PrefService* service = GetProfile()->GetPrefs();
if (service->GetBoolean(prefs::kDisableScreenshots)) {
error_ = keys::kScreenshotsDisabled;
return false;
@@ -1816,8 +1868,14 @@ bool TabsDetectLanguageFunction::RunImpl() {
// in the current window.
if (params->tab_id.get()) {
tab_id = *params->tab_id;
- if (!GetTabById(tab_id, profile(), include_incognito(),
- &browser, NULL, &contents, NULL, &error_)) {
+ if (!GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ NULL,
+ &contents,
+ NULL,
+ &error_)) {
return false;
}
if (!browser || !contents)
@@ -1907,8 +1965,14 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
// If |tab_id| is specified, look for the tab. Otherwise default to selected
// tab in the current window.
CHECK_GE(execute_tab_id_, 0);
- if (!GetTabById(execute_tab_id_, profile(), include_incognito(),
- NULL, NULL, &contents, NULL, &error_)) {
+ if (!GetTabById(execute_tab_id_,
+ GetProfile(),
+ include_incognito(),
+ NULL,
+ NULL,
+ &contents,
+ NULL,
+ &error_)) {
return false;
}
@@ -1935,9 +1999,15 @@ ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor() {
Browser* browser = NULL;
content::WebContents* contents = NULL;
- bool success = GetTabById(
- execute_tab_id_, profile(), include_incognito(), &browser, NULL,
- &contents, NULL, &error_) && contents && browser;
+ bool success = GetTabById(execute_tab_id_,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ NULL,
+ &contents,
+ NULL,
+ &error_) &&
+ contents && browser;
if (!success)
return NULL;
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.h b/chrome/browser/extensions/api/tabs/tabs_api.h
index a3ee038..97e5f1c 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.h
+++ b/chrome/browser/extensions/api/tabs/tabs_api.h
@@ -10,7 +10,7 @@
#include "base/compiler_specific.h"
#include "chrome/browser/extensions/api/execute_code_function.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/tabs.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -42,27 +42,27 @@ class PrefRegistrySyncable;
namespace extensions {
// Windows
-class WindowsGetFunction : public SyncExtensionFunction {
+class WindowsGetFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsGetFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("windows.get", WINDOWS_GET)
};
-class WindowsGetCurrentFunction : public SyncExtensionFunction {
+class WindowsGetCurrentFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsGetCurrentFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("windows.getCurrent", WINDOWS_GETCURRENT)
};
-class WindowsGetLastFocusedFunction : public SyncExtensionFunction {
+class WindowsGetLastFocusedFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsGetLastFocusedFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("windows.getLastFocused", WINDOWS_GETLASTFOCUSED)
};
-class WindowsGetAllFunction : public SyncExtensionFunction {
+class WindowsGetAllFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsGetAllFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("windows.getAll", WINDOWS_GETALL)
};
-class WindowsCreateFunction : public SyncExtensionFunction {
+class WindowsCreateFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsCreateFunction() {}
virtual bool RunImpl() OVERRIDE;
// Returns whether the window should be created in incognito mode.
@@ -78,54 +78,54 @@ class WindowsCreateFunction : public SyncExtensionFunction {
bool* is_error);
DECLARE_EXTENSION_FUNCTION("windows.create", WINDOWS_CREATE)
};
-class WindowsUpdateFunction : public SyncExtensionFunction {
+class WindowsUpdateFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsUpdateFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("windows.update", WINDOWS_UPDATE)
};
-class WindowsRemoveFunction : public SyncExtensionFunction {
+class WindowsRemoveFunction : public ChromeSyncExtensionFunction {
virtual ~WindowsRemoveFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("windows.remove", WINDOWS_REMOVE)
};
// Tabs
-class TabsGetFunction : public SyncExtensionFunction {
+class TabsGetFunction : public ChromeSyncExtensionFunction {
virtual ~TabsGetFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET)
};
-class TabsGetCurrentFunction : public SyncExtensionFunction {
+class TabsGetCurrentFunction : public ChromeSyncExtensionFunction {
virtual ~TabsGetCurrentFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.getCurrent", TABS_GETCURRENT)
};
-class TabsGetSelectedFunction : public SyncExtensionFunction {
+class TabsGetSelectedFunction : public ChromeSyncExtensionFunction {
virtual ~TabsGetSelectedFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.getSelected", TABS_GETSELECTED)
};
-class TabsGetAllInWindowFunction : public SyncExtensionFunction {
+class TabsGetAllInWindowFunction : public ChromeSyncExtensionFunction {
virtual ~TabsGetAllInWindowFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.getAllInWindow", TABS_GETALLINWINDOW)
};
-class TabsQueryFunction : public SyncExtensionFunction {
+class TabsQueryFunction : public ChromeSyncExtensionFunction {
virtual ~TabsQueryFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.query", TABS_QUERY)
};
-class TabsCreateFunction : public SyncExtensionFunction {
+class TabsCreateFunction : public ChromeSyncExtensionFunction {
virtual ~TabsCreateFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.create", TABS_CREATE)
};
-class TabsDuplicateFunction : public SyncExtensionFunction {
+class TabsDuplicateFunction : public ChromeSyncExtensionFunction {
virtual ~TabsDuplicateFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.duplicate", TABS_DUPLICATE)
};
-class TabsHighlightFunction : public SyncExtensionFunction {
+class TabsHighlightFunction : public ChromeSyncExtensionFunction {
virtual ~TabsHighlightFunction() {}
virtual bool RunImpl() OVERRIDE;
bool HighlightTab(TabStripModel* tabstrip,
@@ -134,7 +134,7 @@ class TabsHighlightFunction : public SyncExtensionFunction {
int index);
DECLARE_EXTENSION_FUNCTION("tabs.highlight", TABS_HIGHLIGHT)
};
-class TabsUpdateFunction : public AsyncExtensionFunction {
+class TabsUpdateFunction : public ChromeAsyncExtensionFunction {
public:
TabsUpdateFunction();
@@ -156,7 +156,7 @@ class TabsUpdateFunction : public AsyncExtensionFunction {
DECLARE_EXTENSION_FUNCTION("tabs.update", TABS_UPDATE)
};
-class TabsMoveFunction : public SyncExtensionFunction {
+class TabsMoveFunction : public ChromeSyncExtensionFunction {
virtual ~TabsMoveFunction() {}
virtual bool RunImpl() OVERRIDE;
bool MoveTab(int tab_id,
@@ -166,19 +166,19 @@ class TabsMoveFunction : public SyncExtensionFunction {
int* window_id);
DECLARE_EXTENSION_FUNCTION("tabs.move", TABS_MOVE)
};
-class TabsReloadFunction : public SyncExtensionFunction {
+class TabsReloadFunction : public ChromeSyncExtensionFunction {
virtual ~TabsReloadFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tabs.reload", TABS_RELOAD)
};
-class TabsRemoveFunction : public SyncExtensionFunction {
+class TabsRemoveFunction : public ChromeSyncExtensionFunction {
virtual ~TabsRemoveFunction() {}
virtual bool RunImpl() OVERRIDE;
bool RemoveTab(int tab_id);
DECLARE_EXTENSION_FUNCTION("tabs.remove", TABS_REMOVE)
};
-class TabsDetectLanguageFunction : public AsyncExtensionFunction,
- public content::NotificationObserver {
+class TabsDetectLanguageFunction : public ChromeAsyncExtensionFunction,
+ public content::NotificationObserver {
private:
virtual ~TabsDetectLanguageFunction() {}
virtual bool RunImpl() OVERRIDE;
@@ -190,7 +190,7 @@ class TabsDetectLanguageFunction : public AsyncExtensionFunction,
content::NotificationRegistrar registrar_;
DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE)
};
-class TabsCaptureVisibleTabFunction : public AsyncExtensionFunction {
+class TabsCaptureVisibleTabFunction : public ChromeAsyncExtensionFunction {
public:
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
diff --git a/chrome/browser/extensions/api/tabs/windows_util.cc b/chrome/browser/extensions/api/tabs/windows_util.cc
index b1955fe..19972f6 100644
--- a/chrome/browser/extensions/api/tabs/windows_util.cc
+++ b/chrome/browser/extensions/api/tabs/windows_util.cc
@@ -6,7 +6,7 @@
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/extensions/window_controller_list.h"
@@ -15,7 +15,7 @@
namespace windows_util {
-bool GetWindowFromWindowID(UIThreadExtensionFunction* function,
+bool GetWindowFromWindowID(ChromeAsyncExtensionFunction* function,
int window_id,
extensions::WindowController** controller) {
if (window_id == extension_misc::kCurrentWindowId) {
diff --git a/chrome/browser/extensions/api/tabs/windows_util.h b/chrome/browser/extensions/api/tabs/windows_util.h
index 24ab44b..f3d6c5f 100644
--- a/chrome/browser/extensions/api/tabs/windows_util.h
+++ b/chrome/browser/extensions/api/tabs/windows_util.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__
#define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_UTIL_H__
-class UIThreadExtensionFunction;
+class ChromeAsyncExtensionFunction;
namespace extensions {
class WindowController;
@@ -15,7 +15,7 @@ namespace windows_util {
// Populates |controller| for given |window_id|. If the window is not found,
// returns false and sets UIThreadExtensionFunction error_.
-bool GetWindowFromWindowID(UIThreadExtensionFunction* function,
+bool GetWindowFromWindowID(ChromeAsyncExtensionFunction* function,
int window_id,
extensions::WindowController** controller);
diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.cc b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
index faeb3b5..5ac2492 100644
--- a/chrome/browser/extensions/api/terminal/terminal_private_api.cc
+++ b/chrome/browser/extensions/api/terminal/terminal_private_api.cc
@@ -114,8 +114,9 @@ void TerminalPrivateOpenTerminalProcessFunction::OpenOnFileThread() {
chromeos::ProcessProxyRegistry::Get();
pid_t pid;
if (!registry->OpenProcess(
- command_, &pid,
- base::Bind(&NotifyProcessOutput, profile_, extension_id()))) {
+ command_,
+ &pid,
+ base::Bind(&NotifyProcessOutput, GetProfile(), extension_id()))) {
// If new process could not be opened, we return -1.
pid = -1;
}
diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.h b/chrome/browser/extensions/api/terminal/terminal_private_api.h
index e544f12..ca79049 100644
--- a/chrome/browser/extensions/api/terminal/terminal_private_api.h
+++ b/chrome/browser/extensions/api/terminal/terminal_private_api.h
@@ -7,12 +7,12 @@
#include <string>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
namespace extensions {
// Base class for all terminalPrivate function classes. Main purpose is to run
// permission check before calling actual function implementation.
-class TerminalPrivateFunction : public AsyncExtensionFunction {
+class TerminalPrivateFunction : public ChromeAsyncExtensionFunction {
public:
TerminalPrivateFunction();
diff --git a/chrome/browser/extensions/api/test/test_api.cc b/chrome/browser/extensions/api/test/test_api.cc
index 5cf8051..5a4f485 100644
--- a/chrome/browser/extensions/api/test/test_api.cc
+++ b/chrome/browser/extensions/api/test/test_api.cc
@@ -83,7 +83,7 @@ bool TestLogFunction::RunImpl() {
TestResetQuotaFunction::~TestResetQuotaFunction() {}
bool TestResetQuotaFunction::RunImpl() {
- ExtensionService* service = profile()->GetExtensionService();
+ ExtensionService* service = GetProfile()->GetExtensionService();
ExtensionsQuotaService* quota = service->quota_service();
quota->Purge();
quota->violation_errors_.clear();
@@ -97,8 +97,8 @@ bool TestCreateIncognitoTabFunction::RunImpl() {
scoped_ptr<CreateIncognitoTab::Params> params(
CreateIncognitoTab::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- chrome::OpenURLOffTheRecord(profile(), GURL(params->url),
- chrome::GetActiveDesktop());
+ chrome::OpenURLOffTheRecord(
+ GetProfile(), GURL(params->url), chrome::GetActiveDesktop());
return true;
}
diff --git a/chrome/browser/extensions/api/test/test_api.h b/chrome/browser/extensions/api/test/test_api.h
index fa0c2ab..0916832 100644
--- a/chrome/browser/extensions/api/test/test_api.h
+++ b/chrome/browser/extensions/api/test/test_api.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_EXTENSIONS_API_TEST_TEST_API_H_
#include "base/values.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
template <typename T> struct DefaultSingletonTraits;
@@ -14,7 +14,7 @@ namespace extensions {
// A function that is only available in tests.
// Prior to running, checks that we are in an extension process.
-class TestExtensionFunction : public SyncExtensionFunction {
+class TestExtensionFunction : public ChromeSyncExtensionFunction {
protected:
virtual ~TestExtensionFunction();
@@ -77,7 +77,7 @@ class TestCreateIncognitoTabFunction : public TestExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class TestSendMessageFunction : public AsyncExtensionFunction {
+class TestSendMessageFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("test.sendMessage", UNKNOWN)
@@ -92,7 +92,7 @@ class TestSendMessageFunction : public AsyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class TestGetConfigFunction : public SyncExtensionFunction {
+class TestGetConfigFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("test.getConfig", UNKNOWN)
diff --git a/chrome/browser/extensions/api/top_sites/top_sites_api.cc b/chrome/browser/extensions/api/top_sites/top_sites_api.cc
index 77d5a93..c6accaf 100644
--- a/chrome/browser/extensions/api/top_sites/top_sites_api.cc
+++ b/chrome/browser/extensions/api/top_sites/top_sites_api.cc
@@ -18,7 +18,7 @@ TopSitesGetFunction::TopSitesGetFunction()
TopSitesGetFunction::~TopSitesGetFunction() {}
bool TopSitesGetFunction::RunImpl() {
- history::TopSites* ts = profile()->GetTopSites();
+ history::TopSites* ts = GetProfile()->GetTopSites();
if (!ts)
return false;
diff --git a/chrome/browser/extensions/api/top_sites/top_sites_api.h b/chrome/browser/extensions/api/top_sites/top_sites_api.h
index 7acc608..9cd2b78 100644
--- a/chrome/browser/extensions/api/top_sites/top_sites_api.h
+++ b/chrome/browser/extensions/api/top_sites/top_sites_api.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_EXTENSIONS_API_TOP_SITES_TOP_SITES_API_H_
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/history/history_types.h"
namespace extensions {
-class TopSitesGetFunction : public AsyncExtensionFunction {
+class TopSitesGetFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("topSites.get", TOPSITES_GET)
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc
index 8dd047a..206c019 100644
--- a/chrome/browser/extensions/api/usb/usb_api.cc
+++ b/chrome/browser/extensions/api/usb/usb_api.cc
@@ -396,7 +396,7 @@ UsbAsyncApiFunction::~UsbAsyncApiFunction() {
}
bool UsbAsyncApiFunction::PrePrepare() {
- manager_ = ApiResourceManager<UsbDeviceResource>::Get(profile());
+ manager_ = ApiResourceManager<UsbDeviceResource>::Get(GetProfile());
set_work_thread_id(BrowserThread::FILE);
return manager_ != NULL;
}
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 7616dcc..f4ecce5 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -723,9 +723,10 @@ bool WebNavigationGetFrameFunction::RunImpl() {
content::WebContents* web_contents;
if (!ExtensionTabUtil::GetTabById(tab_id,
- profile(),
+ GetProfile(),
include_incognito(),
- NULL, NULL,
+ NULL,
+ NULL,
&web_contents,
NULL) ||
!web_contents) {
@@ -777,9 +778,10 @@ bool WebNavigationGetAllFramesFunction::RunImpl() {
content::WebContents* web_contents;
if (!ExtensionTabUtil::GetTabById(tab_id,
- profile(),
+ GetProfile(),
include_incognito(),
- NULL, NULL,
+ NULL,
+ NULL,
&web_contents,
NULL) ||
!web_contents) {
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
index eeb25ec..00f17fe 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h
@@ -14,8 +14,8 @@
#include "base/compiler_specific.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -206,14 +206,14 @@ class WebNavigationEventRouter : public TabStripModelObserver,
};
// API function that returns the state of a given frame.
-class WebNavigationGetFrameFunction : public SyncExtensionFunction {
+class WebNavigationGetFrameFunction : public ChromeSyncExtensionFunction {
virtual ~WebNavigationGetFrameFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("webNavigation.getFrame", WEBNAVIGATION_GETFRAME)
};
// API function that returns the states of all frames in a given tab.
-class WebNavigationGetAllFramesFunction : public SyncExtensionFunction {
+class WebNavigationGetAllFramesFunction : public ChromeSyncExtensionFunction {
virtual ~WebNavigationGetAllFramesFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("webNavigation.getAllFrames",
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
index 9b48335..19ab252 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
@@ -141,8 +141,8 @@ void WebrtcAudioPrivateGetSinksFunction::DoneOnUIThread() {
bool WebrtcAudioPrivateTabIdFunction::DoRunImpl(int tab_id) {
content::WebContents* contents = NULL;
- if (!ExtensionTabUtil::GetTabById(tab_id, profile(), true,
- NULL, NULL, &contents, NULL)) {
+ if (!ExtensionTabUtil::GetTabById(
+ tab_id, GetProfile(), true, NULL, NULL, &contents, NULL)) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::tabs_constants::kTabNotFoundError,
base::IntToString(tab_id));
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
index 94571d9..3f53056 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
@@ -8,7 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/system_monitor/system_monitor.h"
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/webrtc_audio_private.h"
#include "content/public/browser/render_view_host.h"
@@ -47,8 +47,7 @@ class WebrtcAudioPrivateEventService
Profile* profile_;
};
-class WebrtcAudioPrivateGetSinksFunction
- : public AsyncExtensionFunction {
+class WebrtcAudioPrivateGetSinksFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~WebrtcAudioPrivateGetSinksFunction() {}
@@ -63,7 +62,7 @@ class WebrtcAudioPrivateGetSinksFunction
// Common base for functions that start by retrieving the list of
// controllers for the specified tab.
-class WebrtcAudioPrivateTabIdFunction : public AsyncExtensionFunction {
+class WebrtcAudioPrivateTabIdFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~WebrtcAudioPrivateTabIdFunction() {}
@@ -120,7 +119,7 @@ class WebrtcAudioPrivateSetActiveSinkFunction
};
class WebrtcAudioPrivateGetAssociatedSinkFunction
- : public AsyncExtensionFunction {
+ : public ChromeAsyncExtensionFunction {
protected:
virtual ~WebrtcAudioPrivateGetAssociatedSinkFunction();
diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
index 6909657..0100027 100644
--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
@@ -36,8 +36,8 @@ content::RenderProcessHost*
WebrtcLoggingPrivateTabIdFunction::RphFromTabIdAndSecurityOrigin(
int tab_id, const std::string& security_origin) {
content::WebContents* contents = NULL;
- if (!ExtensionTabUtil::GetTabById(tab_id, profile(), true,
- NULL, NULL, &contents, NULL)) {
+ if (!ExtensionTabUtil::GetTabById(
+ tab_id, GetProfile(), true, NULL, NULL, &contents, NULL)) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::tabs_constants::kTabNotFoundError,
base::IntToString(tab_id));
diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h
index 27af5d5..9bf1326 100644
--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIVATE_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/webrtc_logging_private.h"
namespace content {
@@ -17,7 +17,7 @@ class RenderProcessHost;
namespace extensions {
// TODO(grunell). Merge this with WebrtcAudioPrivateTabIdFunction.
-class WebrtcLoggingPrivateTabIdFunction : public AsyncExtensionFunction {
+class WebrtcLoggingPrivateTabIdFunction : public ChromeAsyncExtensionFunction {
protected:
virtual ~WebrtcLoggingPrivateTabIdFunction() {}
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
index ec5e975..3c664aa 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -293,9 +293,10 @@ bool WebstorePrivateBeginInstallWithManifest3Function::RunImpl() {
*params_->details.icon_data : std::string();
ExtensionService* service =
- extensions::ExtensionSystem::Get(profile_)->extension_service();
+ extensions::ExtensionSystem::Get(GetProfile())->extension_service();
if (service->GetInstalledExtension(params_->details.id) ||
- !g_pending_installs.Get().InsertInstall(profile_, params_->details.id)) {
+ !g_pending_installs.Get().InsertInstall(GetProfile(),
+ params_->details.id)) {
SetResultCode(ALREADY_INSTALLED);
error_ = kAlreadyInstalledError;
return false;
@@ -303,7 +304,7 @@ bool WebstorePrivateBeginInstallWithManifest3Function::RunImpl() {
net::URLRequestContextGetter* context_getter = NULL;
if (!icon_url.is_empty())
- context_getter = profile()->GetRequestContext();
+ context_getter = GetProfile()->GetRequestContext();
scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper(
this, params_->details.id, params_->details.manifest, icon_data, icon_url,
@@ -384,12 +385,12 @@ void WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess(
}
SigninManagerBase* signin_manager =
- SigninManagerFactory::GetForProfile(profile());
+ SigninManagerFactory::GetForProfile(GetProfile());
if (dummy_extension_->is_platform_app() &&
signin_manager &&
signin_manager->GetAuthenticatedUsername().empty() &&
signin_manager->AuthInProgress()) {
- signin_tracker_.reset(new SigninTracker(profile(), this));
+ signin_tracker_.reset(new SigninTracker(GetProfile(), this));
return;
}
@@ -417,7 +418,7 @@ void WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseFailure(
CHECK(false);
}
error_ = error_message;
- g_pending_installs.Get().EraseInstall(profile_, id);
+ g_pending_installs.Get().EraseInstall(GetProfile(), id);
SendResponse(false);
// Matches the AddRef in RunImpl().
@@ -430,7 +431,7 @@ void WebstorePrivateBeginInstallWithManifest3Function::SigninFailed(
SetResultCode(SIGNIN_FAILED);
error_ = error.ToString();
- g_pending_installs.Get().EraseInstall(profile_, params_->details.id);
+ g_pending_installs.Get().EraseInstall(GetProfile(), params_->details.id);
SendResponse(false);
// Matches the AddRef in RunImpl().
@@ -463,7 +464,7 @@ void WebstorePrivateBeginInstallWithManifest3Function::InstallUIProceed() {
// entry is only valid for some number of minutes.
scoped_ptr<WebstoreInstaller::Approval> approval(
WebstoreInstaller::Approval::CreateWithNoInstallPrompt(
- profile(), params_->details.id, parsed_manifest_.Pass(), false));
+ GetProfile(), params_->details.id, parsed_manifest_.Pass(), false));
approval->use_app_installed_bubble = params_->details.app_install_bubble;
approval->enable_launcher = params_->details.enable_launcher;
// If we are enabling the launcher, we should not show the app list in order
@@ -490,7 +491,7 @@ void WebstorePrivateBeginInstallWithManifest3Function::InstallUIAbort(
bool user_initiated) {
error_ = kUserCancelledError;
SetResultCode(USER_CANCELLED);
- g_pending_installs.Get().EraseInstall(profile_, params_->details.id);
+ g_pending_installs.Get().EraseInstall(GetProfile(), params_->details.id);
SendResponse(false);
// The web store install histograms are a subset of the install histograms.
@@ -527,8 +528,9 @@ bool WebstorePrivateCompleteInstallFunction::RunImpl() {
return false;
}
- approval_ = g_pending_approvals.Get().PopApproval(profile(),
- params->expected_id).Pass();
+ approval_ = g_pending_approvals.Get()
+ .PopApproval(GetProfile(), params->expected_id)
+ .Pass();
if (!approval_) {
error_ = ErrorUtils::FormatErrorMessage(
kNoPreviousBeginInstallWithManifestError, params->expected_id);
@@ -541,23 +543,25 @@ bool WebstorePrivateCompleteInstallFunction::RunImpl() {
AppListService::Get(GetCurrentBrowser()->host_desktop_type());
if (approval_->enable_launcher)
- app_list_service->EnableAppList(profile());
+ app_list_service->EnableAppList(GetProfile());
if (IsAppLauncherEnabled() && approval_->manifest->is_app()) {
// Show the app list to show download is progressing. Don't show the app
// list on first app install so users can be trained to open it themselves.
if (approval_->enable_launcher)
- app_list_service->CreateForProfile(profile());
+ app_list_service->CreateForProfile(GetProfile());
else
- app_list_service->ShowForProfile(profile());
+ app_list_service->ShowForProfile(GetProfile());
}
// The extension will install through the normal extension install flow, but
// the whitelist entry will bypass the normal permissions install dialog.
scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
- profile(), this,
+ GetProfile(),
+ this,
&(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()),
- params->expected_id, approval_.Pass(),
+ params->expected_id,
+ approval_.Pass(),
WebstoreInstaller::INSTALL_SOURCE_OTHER);
installer->Start();
@@ -570,7 +574,7 @@ void WebstorePrivateCompleteInstallFunction::OnExtensionInstallSuccess(
test_webstore_installer_delegate->OnExtensionInstallSuccess(id);
LOG(INFO) << "Install success, sending response";
- g_pending_installs.Get().EraseInstall(profile_, id);
+ g_pending_installs.Get().EraseInstall(GetProfile(), id);
SendResponse(true);
// Matches the AddRef in RunImpl().
@@ -588,7 +592,7 @@ void WebstorePrivateCompleteInstallFunction::OnExtensionInstallFailure(
error_ = error;
LOG(INFO) << "Install failed, sending response";
- g_pending_installs.Get().EraseInstall(profile_, id);
+ g_pending_installs.Get().EraseInstall(GetProfile(), id);
SendResponse(false);
// Matches the AddRef in RunImpl().
@@ -603,20 +607,20 @@ WebstorePrivateEnableAppLauncherFunction::
bool WebstorePrivateEnableAppLauncherFunction::RunImpl() {
AppListService::Get(GetCurrentBrowser()->host_desktop_type())->
- EnableAppList(profile());
+ EnableAppList(GetProfile());
return true;
}
bool WebstorePrivateGetBrowserLoginFunction::RunImpl() {
GetBrowserLogin::Results::Info info;
- info.login = profile_->GetOriginalProfile()->GetPrefs()->GetString(
+ info.login = GetProfile()->GetOriginalProfile()->GetPrefs()->GetString(
prefs::kGoogleServicesUsername);
results_ = GetBrowserLogin::Results::Create(info);
return true;
}
bool WebstorePrivateGetStoreLoginFunction::RunImpl() {
- results_ = GetStoreLogin::Results::Create(GetWebstoreLogin(profile_));
+ results_ = GetStoreLogin::Results::Create(GetWebstoreLogin(GetProfile()));
return true;
}
@@ -624,7 +628,7 @@ bool WebstorePrivateSetStoreLoginFunction::RunImpl() {
scoped_ptr<SetStoreLogin::Params> params(
SetStoreLogin::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- SetWebstoreLogin(profile_, params->login);
+ SetWebstoreLogin(GetProfile(), params->login);
return true;
}
@@ -661,7 +665,7 @@ bool WebstorePrivateGetIsLauncherEnabledFunction::RunImpl() {
bool WebstorePrivateIsInIncognitoModeFunction::RunImpl() {
results_ = IsInIncognitoMode::Results::Create(
- profile_ != profile_->GetOriginalProfile());
+ GetProfile() != GetProfile()->GetOriginalProfile());
return true;
}
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
index a28fa79..a2df65d 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
@@ -8,7 +8,7 @@
#include <string>
#include "chrome/browser/extensions/bundle_installer.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "chrome/browser/extensions/webstore_installer.h"
@@ -43,8 +43,9 @@ class WebstorePrivateApi {
Profile* profile, const std::string& extension_id);
};
-class WebstorePrivateInstallBundleFunction : public AsyncExtensionFunction,
- public extensions::BundleInstaller::Delegate {
+class WebstorePrivateInstallBundleFunction
+ : public ChromeAsyncExtensionFunction,
+ public extensions::BundleInstaller::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle",
WEBSTOREPRIVATE_INSTALLBUNDLE)
@@ -72,7 +73,7 @@ class WebstorePrivateInstallBundleFunction : public AsyncExtensionFunction,
};
class WebstorePrivateBeginInstallWithManifest3Function
- : public AsyncExtensionFunction,
+ : public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate,
public WebstoreInstallHelper::Delegate,
public SigninTracker::Observer {
@@ -167,7 +168,7 @@ class WebstorePrivateBeginInstallWithManifest3Function
};
class WebstorePrivateCompleteInstallFunction
- : public AsyncExtensionFunction,
+ : public ChromeAsyncExtensionFunction,
public WebstoreInstaller::Delegate {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall",
@@ -193,7 +194,7 @@ class WebstorePrivateCompleteInstallFunction
};
class WebstorePrivateEnableAppLauncherFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher",
WEBSTOREPRIVATE_ENABLEAPPLAUNCHER)
@@ -207,7 +208,8 @@ class WebstorePrivateEnableAppLauncherFunction
virtual bool RunImpl() OVERRIDE;
};
-class WebstorePrivateGetBrowserLoginFunction : public SyncExtensionFunction {
+class WebstorePrivateGetBrowserLoginFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.getBrowserLogin",
WEBSTOREPRIVATE_GETBROWSERLOGIN)
@@ -219,7 +221,8 @@ class WebstorePrivateGetBrowserLoginFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class WebstorePrivateGetStoreLoginFunction : public SyncExtensionFunction {
+class WebstorePrivateGetStoreLoginFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.getStoreLogin",
WEBSTOREPRIVATE_GETSTORELOGIN)
@@ -231,7 +234,8 @@ class WebstorePrivateGetStoreLoginFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class WebstorePrivateSetStoreLoginFunction : public SyncExtensionFunction {
+class WebstorePrivateSetStoreLoginFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.setStoreLogin",
WEBSTOREPRIVATE_SETSTORELOGIN)
@@ -243,7 +247,8 @@ class WebstorePrivateSetStoreLoginFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class WebstorePrivateGetWebGLStatusFunction : public AsyncExtensionFunction {
+class WebstorePrivateGetWebGLStatusFunction
+ : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.getWebGLStatus",
WEBSTOREPRIVATE_GETWEBGLSTATUS)
@@ -265,7 +270,7 @@ class WebstorePrivateGetWebGLStatusFunction : public AsyncExtensionFunction {
};
class WebstorePrivateGetIsLauncherEnabledFunction
- : public SyncExtensionFunction {
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled",
WEBSTOREPRIVATE_GETISLAUNCHERENABLED)
@@ -282,7 +287,8 @@ class WebstorePrivateGetIsLauncherEnabledFunction
void OnIsLauncherCheckCompleted(bool is_enabled);
};
-class WebstorePrivateIsInIncognitoModeFunction : public SyncExtensionFunction {
+class WebstorePrivateIsInIncognitoModeFunction
+ : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode",
WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION)
diff --git a/chrome/browser/extensions/chrome_extension_function.cc b/chrome/browser/extensions/chrome_extension_function.cc
new file mode 100644
index 0000000..9b99e47
--- /dev/null
+++ b/chrome/browser/extensions/chrome_extension_function.cc
@@ -0,0 +1,114 @@
+// Copyright 2013 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/extensions/chrome_extension_function.h"
+
+#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "chrome/browser/extensions/window_controller.h"
+#include "chrome/browser/extensions/window_controller_list.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/render_view_host.h"
+
+using content::RenderViewHost;
+using content::WebContents;
+
+ChromeAsyncExtensionFunction::ChromeAsyncExtensionFunction() {}
+
+Profile* ChromeAsyncExtensionFunction::GetProfile() const {
+ return Profile::FromBrowserContext(context_);
+}
+
+bool ChromeAsyncExtensionFunction::CanOperateOnWindow(
+ const extensions::WindowController* window_controller) const {
+ const extensions::Extension* extension = GetExtension();
+ // |extension| is NULL for unit tests only.
+ if (extension != NULL && !window_controller->IsVisibleToExtension(extension))
+ return false;
+
+ if (GetProfile() == window_controller->profile())
+ return true;
+
+ if (!include_incognito())
+ return false;
+
+ return GetProfile()->HasOffTheRecordProfile() &&
+ GetProfile()->GetOffTheRecordProfile() == window_controller->profile();
+}
+
+// TODO(stevenjb): Replace this with GetExtensionWindowController().
+Browser* ChromeAsyncExtensionFunction::GetCurrentBrowser() {
+ // If the delegate has an associated browser, return it.
+ if (dispatcher()) {
+ extensions::WindowController* window_controller =
+ dispatcher()->delegate()->GetExtensionWindowController();
+ if (window_controller) {
+ Browser* browser = window_controller->GetBrowser();
+ if (browser)
+ return browser;
+ }
+ }
+
+ // Otherwise, try to default to a reasonable browser. If |include_incognito_|
+ // is true, we will also search browsers in the incognito version of this
+ // profile. Note that the profile may already be incognito, in which case
+ // we will search the incognito version only, regardless of the value of
+ // |include_incognito|. Look only for browsers on the active desktop as it is
+ // preferable to pretend no browser is open then to return a browser on
+ // another desktop.
+ if (render_view_host_) {
+ Profile* profile = Profile::FromBrowserContext(
+ render_view_host_->GetProcess()->GetBrowserContext());
+ Browser* browser = chrome::FindAnyBrowser(
+ profile, include_incognito_, chrome::GetActiveDesktop());
+ if (browser)
+ return browser;
+ }
+
+ // NOTE(rafaelw): This can return NULL in some circumstances. In particular,
+ // a background_page onload chrome.tabs api call can make it into here
+ // before the browser is sufficiently initialized to return here, or
+ // all of this profile's browser windows may have been closed.
+ // A similar situation may arise during shutdown.
+ // TODO(rafaelw): Delay creation of background_page until the browser
+ // is available. http://code.google.com/p/chromium/issues/detail?id=13284
+ return NULL;
+}
+
+extensions::WindowController*
+ChromeAsyncExtensionFunction::GetExtensionWindowController() {
+ // If the delegate has an associated window controller, return it.
+ if (dispatcher()) {
+ extensions::WindowController* window_controller =
+ dispatcher()->delegate()->GetExtensionWindowController();
+ if (window_controller)
+ return window_controller;
+ }
+
+ return extensions::WindowControllerList::GetInstance()
+ ->CurrentWindowForFunction(this);
+}
+
+content::WebContents* ChromeAsyncExtensionFunction::GetAssociatedWebContents() {
+ content::WebContents* web_contents =
+ UIThreadExtensionFunction::GetAssociatedWebContents();
+ if (web_contents)
+ return web_contents;
+
+ Browser* browser = GetCurrentBrowser();
+ if (!browser)
+ return NULL;
+ return browser->tab_strip_model()->GetActiveWebContents();
+}
+
+ChromeAsyncExtensionFunction::~ChromeAsyncExtensionFunction() {}
+
+ChromeSyncExtensionFunction::ChromeSyncExtensionFunction() {}
+
+void ChromeSyncExtensionFunction::Run() { SendResponse(RunImpl()); }
+
+ChromeSyncExtensionFunction::~ChromeSyncExtensionFunction() {}
diff --git a/chrome/browser/extensions/chrome_extension_function.h b/chrome/browser/extensions/chrome_extension_function.h
new file mode 100644
index 0000000..5da6855
--- /dev/null
+++ b/chrome/browser/extensions/chrome_extension_function.h
@@ -0,0 +1,77 @@
+// Copyright 2013 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_
+#define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_
+
+#include "chrome/browser/extensions/extension_function.h"
+
+class Browser;
+class Profile;
+
+namespace content {
+class WebContents;
+}
+
+namespace extensions {
+class WindowController;
+}
+
+// A chrome specific analog to AsyncExtensionFunction. This has access
+// the a chrome Profile.
+class ChromeAsyncExtensionFunction : public UIThreadExtensionFunction {
+ public:
+ ChromeAsyncExtensionFunction();
+
+ Profile* GetProfile() const;
+
+ // Returns true if this function (and the profile and extension that it was
+ // invoked from) can operate on the window wrapped by |window_controller|.
+ bool CanOperateOnWindow(const extensions::WindowController* window_controller)
+ const;
+
+ // Gets the "current" browser, if any.
+ //
+ // Many extension APIs operate relative to the current browser, which is the
+ // browser the calling code is running inside of. For example, popups, tabs,
+ // and infobars all have a containing browser, but background pages and
+ // notification bubbles do not.
+ //
+ // If there is no containing window, the current browser defaults to the
+ // foremost one.
+ //
+ // Incognito browsers are not considered unless the calling extension has
+ // incognito access enabled.
+ //
+ // This method can return NULL if there is no matching browser, which can
+ // happen if only incognito windows are open, or early in startup or shutdown
+ // shutdown when there are no active windows.
+ //
+ // TODO(stevenjb): Replace this with GetExtensionWindowController().
+ Browser* GetCurrentBrowser();
+
+ // Same as above but uses WindowControllerList instead of BrowserList.
+ extensions::WindowController* GetExtensionWindowController();
+
+ // Gets the "current" web contents if any. If there is no associated web
+ // contents then defaults to the foremost one.
+ virtual content::WebContents* GetAssociatedWebContents() OVERRIDE;
+
+ protected:
+ virtual ~ChromeAsyncExtensionFunction();
+};
+
+// A chrome specific analog to SyncExtensionFunction. This has access
+// the a chrome Profile.
+class ChromeSyncExtensionFunction : public ChromeAsyncExtensionFunction {
+ public:
+ ChromeSyncExtensionFunction();
+
+ virtual void Run() OVERRIDE;
+
+ protected:
+ virtual ~ChromeSyncExtensionFunction();
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_H_
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc
index 5b5ea2a..f63d4fd 100644
--- a/chrome/browser/extensions/extension_function.cc
+++ b/chrome/browser/extensions/extension_function.cc
@@ -8,18 +8,11 @@
#include "base/metrics/histogram.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/window_controller.h"
-#include "chrome/browser/extensions/window_controller_list.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/chrome_render_message_filter.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/api/extension_api.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
@@ -154,10 +147,7 @@ void ExtensionFunction::SendResponseImpl(bool success) {
}
UIThreadExtensionFunction::UIThreadExtensionFunction()
- : render_view_host_(NULL),
- profile_(NULL),
- delegate_(NULL) {
-}
+ : render_view_host_(NULL), context_(NULL), delegate_(NULL) {}
UIThreadExtensionFunction::~UIThreadExtensionFunction() {
if (dispatcher() && render_view_host())
@@ -184,88 +174,12 @@ void UIThreadExtensionFunction::SetRenderViewHost(
tracker_.reset(render_view_host ? new RenderViewHostTracker(this) : NULL);
}
-// TODO(stevenjb): Replace this with GetExtensionWindowController().
-Browser* UIThreadExtensionFunction::GetCurrentBrowser() {
- // If the delegate has an associated browser, return it.
- if (dispatcher()) {
- extensions::WindowController* window_controller =
- dispatcher()->delegate()->GetExtensionWindowController();
- if (window_controller) {
- Browser* browser = window_controller->GetBrowser();
- if (browser)
- return browser;
- }
- }
-
- // Otherwise, try to default to a reasonable browser. If |include_incognito_|
- // is true, we will also search browsers in the incognito version of this
- // profile. Note that the profile may already be incognito, in which case
- // we will search the incognito version only, regardless of the value of
- // |include_incognito|. Look only for browsers on the active desktop as it is
- // preferable to pretend no browser is open then to return a browser on
- // another desktop.
- if (render_view_host_) {
- Profile* profile = Profile::FromBrowserContext(
- render_view_host_->GetProcess()->GetBrowserContext());
- Browser* browser = chrome::FindAnyBrowser(profile, include_incognito_,
- chrome::GetActiveDesktop());
- if (browser)
- return browser;
- }
-
- // NOTE(rafaelw): This can return NULL in some circumstances. In particular,
- // a background_page onload chrome.tabs api call can make it into here
- // before the browser is sufficiently initialized to return here, or
- // all of this profile's browser windows may have been closed.
- // A similar situation may arise during shutdown.
- // TODO(rafaelw): Delay creation of background_page until the browser
- // is available. http://code.google.com/p/chromium/issues/detail?id=13284
- return NULL;
-}
-
content::WebContents* UIThreadExtensionFunction::GetAssociatedWebContents() {
- if (dispatcher()) {
- content::WebContents* web_contents =
- dispatcher()->delegate()->GetAssociatedWebContents();
- if (web_contents)
- return web_contents;
- }
-
- Browser* browser = GetCurrentBrowser();
- if (!browser)
- return NULL;
- return browser->tab_strip_model()->GetActiveWebContents();
-}
-
-extensions::WindowController*
-UIThreadExtensionFunction::GetExtensionWindowController() {
- // If the delegate has an associated window controller, return it.
- if (dispatcher()) {
- extensions::WindowController* window_controller =
- dispatcher()->delegate()->GetExtensionWindowController();
- if (window_controller)
- return window_controller;
- }
-
- return extensions::WindowControllerList::GetInstance()->
- CurrentWindowForFunction(this);
-}
-
-bool UIThreadExtensionFunction::CanOperateOnWindow(
- const extensions::WindowController* window_controller) const {
- const extensions::Extension* extension = GetExtension();
- // |extension| is NULL for unit tests only.
- if (extension != NULL && !window_controller->IsVisibleToExtension(extension))
- return false;
-
- if (profile() == window_controller->profile())
- return true;
-
- if (!include_incognito())
- return false;
+ content::WebContents* web_contents = NULL;
+ if (dispatcher())
+ web_contents = dispatcher()->delegate()->GetAssociatedWebContents();
- return profile()->HasOffTheRecordProfile() &&
- profile()->GetOffTheRecordProfile() == window_controller->profile();
+ return web_contents;
}
void UIThreadExtensionFunction::SendResponse(bool success) {
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h
index d26ae1e..2834823 100644
--- a/chrome/browser/extensions/extension_function.h
+++ b/chrome/browser/extensions/extension_function.h
@@ -22,13 +22,11 @@
#include "content/public/common/console_message_level.h"
#include "ipc/ipc_message.h"
-class Browser;
class ChromeRenderMessageFilter;
class ExtensionFunction;
class ExtensionFunctionDispatcher;
class UIThreadExtensionFunction;
class IOThreadExtensionFunction;
-class Profile;
class QuotaLimitHeuristic;
namespace base {
@@ -37,14 +35,11 @@ class Value;
}
namespace content {
+class BrowserContext;
class RenderViewHost;
class WebContents;
}
-namespace extensions {
-class WindowController;
-}
-
#ifdef NDEBUG
#define EXTENSION_FUNCTION_VALIDATE(test) do { \
if (!(test)) { \
@@ -218,7 +213,7 @@ class ExtensionFunction
// Id of this request, used to map the response back to the caller.
int request_id_;
- // The Profile of this function's extension.
+ // The id of the profile of this function's extension.
void* profile_id_;
// The extension that called this function.
@@ -294,10 +289,10 @@ class UIThreadExtensionFunction : public ExtensionFunction {
// Should return true if it processed the message.
virtual bool OnMessageReceivedFromRenderView(const IPC::Message& message);
- // Set the profile which contains the extension that has originated this
- // function call.
- void set_profile(Profile* profile) { profile_ = profile; }
- Profile* profile() const { return profile_; }
+ // Set the browser context which contains the extension that has originated
+ // this function call.
+ void set_context(content::BrowserContext* context) { context_ = context; }
+ content::BrowserContext* context() const { return context_; }
void SetRenderViewHost(content::RenderViewHost* render_view_host);
content::RenderViewHost* render_view_host() const {
@@ -312,37 +307,9 @@ class UIThreadExtensionFunction : public ExtensionFunction {
return dispatcher_.get();
}
- // Gets the "current" browser, if any.
- //
- // Many extension APIs operate relative to the current browser, which is the
- // browser the calling code is running inside of. For example, popups, tabs,
- // and infobars all have a containing browser, but background pages and
- // notification bubbles do not.
- //
- // If there is no containing window, the current browser defaults to the
- // foremost one.
- //
- // Incognito browsers are not considered unless the calling extension has
- // incognito access enabled.
- //
- // This method can return NULL if there is no matching browser, which can
- // happen if only incognito windows are open, or early in startup or shutdown
- // shutdown when there are no active windows.
- //
- // TODO(stevenjb): Replace this with GetExtensionWindowController().
- Browser* GetCurrentBrowser();
-
// Gets the "current" web contents if any. If there is no associated web
// contents then defaults to the foremost one.
- content::WebContents* GetAssociatedWebContents();
-
- // Same as above but uses WindowControllerList instead of BrowserList.
- extensions::WindowController* GetExtensionWindowController();
-
- // Returns true if this function (and the profile and extension that it was
- // invoked from) can operate on the window wrapped by |window_controller|.
- bool CanOperateOnWindow(
- const extensions::WindowController* window_controller) const;
+ virtual content::WebContents* GetAssociatedWebContents();
protected:
// Emits a message to the extension's devtools console.
@@ -363,8 +330,8 @@ class UIThreadExtensionFunction : public ExtensionFunction {
// The RenderViewHost we will send responses too.
content::RenderViewHost* render_view_host_;
- // The Profile of this function's extension.
- Profile* profile_;
+ // The content::BrowserContext of this function's extension.
+ content::BrowserContext* context_;
private:
class RenderViewHostTracker;
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 85961e3..a61348b 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -352,7 +352,7 @@ void ExtensionFunctionDispatcher::DispatchWithCallback(
}
function_ui->SetRenderViewHost(render_view_host);
function_ui->set_dispatcher(AsWeakPtr());
- function_ui->set_profile(profile_);
+ function_ui->set_context(profile_);
function->set_include_incognito(extension_util::CanCrossIncognito(extension,
service));
diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc
index 40651a8..de33b9f 100644
--- a/chrome/browser/extensions/extension_function_test_utils.cc
+++ b/chrome/browser/extensions/extension_function_test_utils.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -254,7 +255,7 @@ bool RunFunction(UIThreadExtensionFunction* function,
browser->profile(), &dispatcher_delegate);
function->set_dispatcher(dispatcher.AsWeakPtr());
- function->set_profile(browser->profile());
+ function->set_context(browser->profile());
function->set_include_incognito(flags & INCLUDE_INCOGNITO);
function->Run();
diff --git a/chrome/browser/extensions/window_controller_list.cc b/chrome/browser/extensions/window_controller_list.cc
index 3c2b68b..608d3e5 100644
--- a/chrome/browser/extensions/window_controller_list.cc
+++ b/chrome/browser/extensions/window_controller_list.cc
@@ -6,7 +6,7 @@
#include <algorithm>
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/window_controller_list_observer.h"
#include "chrome/browser/sessions/session_id.h"
#include "ui/base/base_window.h"
@@ -62,7 +62,7 @@ WindowController* WindowControllerList::FindWindowById(int id) const {
}
WindowController* WindowControllerList::FindWindowForFunctionById(
- const UIThreadExtensionFunction* function,
+ const ChromeAsyncExtensionFunction* function,
int id) const {
WindowController* controller = FindWindowById(id);
if (controller && function->CanOperateOnWindow(controller))
@@ -71,7 +71,7 @@ WindowController* WindowControllerList::FindWindowForFunctionById(
}
WindowController* WindowControllerList::CurrentWindowForFunction(
- const UIThreadExtensionFunction* function) const {
+ const ChromeAsyncExtensionFunction* function) const {
WindowController* result = NULL;
// Returns either the focused window (if any), or the last window in the list.
for (ControllerList::const_iterator iter = windows().begin();
diff --git a/chrome/browser/extensions/window_controller_list.h b/chrome/browser/extensions/window_controller_list.h
index 4b9b934..103069f 100644
--- a/chrome/browser/extensions/window_controller_list.h
+++ b/chrome/browser/extensions/window_controller_list.h
@@ -13,7 +13,7 @@
#include "chrome/browser/extensions/window_controller.h"
class Profile;
-class UIThreadExtensionFunction;
+class ChromeAsyncExtensionFunction;
namespace extensions {
@@ -38,13 +38,13 @@ class WindowControllerList {
// Returns a window matching the context the function was invoked in.
WindowController* FindWindowForFunctionById(
- const UIThreadExtensionFunction* function,
+ const ChromeAsyncExtensionFunction* function,
int id) const;
// Returns the focused or last added window matching the context the function
// was invoked in.
WindowController* CurrentWindowForFunction(
- const UIThreadExtensionFunction* function) const;
+ const ChromeAsyncExtensionFunction* function) const;
const ControllerList& windows() const { return windows_; }
diff --git a/chrome/browser/infobars/infobar_extension_api.cc b/chrome/browser/infobars/infobar_extension_api.cc
index 5454b06..3868b56 100644
--- a/chrome/browser/infobars/infobar_extension_api.cc
+++ b/chrome/browser/infobars/infobar_extension_api.cc
@@ -50,14 +50,13 @@ bool InfobarsShowFunction::RunImpl() {
Browser* browser = NULL;
content::WebContents* web_contents = NULL;
- if (!ExtensionTabUtil::GetTabById(
- tab_id,
- profile(),
- include_incognito(),
- &browser,
- NULL,
- &web_contents,
- NULL)) {
+ if (!ExtensionTabUtil::GetTabById(tab_id,
+ GetProfile(),
+ include_incognito(),
+ &browser,
+ NULL,
+ &web_contents,
+ NULL)) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::tabs_constants::kTabNotFoundError,
base::IntToString(tab_id));
diff --git a/chrome/browser/infobars/infobar_extension_api.h b/chrome/browser/infobars/infobar_extension_api.h
index 80bd7f7..2ef2df7 100644
--- a/chrome/browser/infobars/infobar_extension_api.h
+++ b/chrome/browser/infobars/infobar_extension_api.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_INFOBARS_INFOBAR_EXTENSION_API_H_
#define CHROME_BROWSER_INFOBARS_INFOBAR_EXTENSION_API_H_
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
-class InfobarsShowFunction : public SyncExtensionFunction {
+class InfobarsShowFunction : public ChromeSyncExtensionFunction {
virtual ~InfobarsShowFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("infobars.show", INFOBARS_SHOW)
diff --git a/chrome/browser/speech/extension_api/tts_extension_api.cc b/chrome/browser/speech/extension_api/tts_extension_api.cc
index 4137421..6523b4e 100644
--- a/chrome/browser/speech/extension_api/tts_extension_api.cc
+++ b/chrome/browser/speech/extension_api/tts_extension_api.cc
@@ -256,7 +256,7 @@ bool TtsSpeakFunction::RunImpl() {
continuous_params.pitch = pitch;
continuous_params.volume = volume;
- Utterance* utterance = new Utterance(profile());
+ Utterance* utterance = new Utterance(GetProfile());
utterance->set_text(text);
utterance->set_voice_name(voice_name);
utterance->set_src_extension_id(extension_id());
@@ -300,7 +300,7 @@ bool TtsIsSpeakingFunction::RunImpl() {
bool TtsGetVoicesFunction::RunImpl() {
std::vector<VoiceData> voices;
- TtsController::GetInstance()->GetVoices(profile(), &voices);
+ TtsController::GetInstance()->GetVoices(GetProfile(), &voices);
scoped_ptr<ListValue> result_voices(new ListValue());
for (size_t i = 0; i < voices.size(); ++i) {
diff --git a/chrome/browser/speech/extension_api/tts_extension_api.h b/chrome/browser/speech/extension_api/tts_extension_api.h
index e2ed95c..a8f3c19 100644
--- a/chrome/browser/speech/extension_api/tts_extension_api.h
+++ b/chrome/browser/speech/extension_api/tts_extension_api.h
@@ -8,7 +8,7 @@
#include <string>
#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
-#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/speech/tts_controller.h"
class Profile;
@@ -18,43 +18,42 @@ TtsEventType TtsEventTypeFromString(const std::string& str);
namespace extensions {
-class TtsSpeakFunction
- : public AsyncExtensionFunction {
+class TtsSpeakFunction : public ChromeAsyncExtensionFunction {
private:
virtual ~TtsSpeakFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tts.speak", TTS_SPEAK)
};
-class TtsStopSpeakingFunction : public SyncExtensionFunction {
+class TtsStopSpeakingFunction : public ChromeSyncExtensionFunction {
private:
virtual ~TtsStopSpeakingFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tts.stop", TTS_STOP)
};
-class TtsPauseFunction : public SyncExtensionFunction {
+class TtsPauseFunction : public ChromeSyncExtensionFunction {
private:
virtual ~TtsPauseFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tts.pause", TTS_PAUSE)
};
-class TtsResumeFunction : public SyncExtensionFunction {
+class TtsResumeFunction : public ChromeSyncExtensionFunction {
private:
virtual ~TtsResumeFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tts.resume", TTS_RESUME)
};
-class TtsIsSpeakingFunction : public SyncExtensionFunction {
+class TtsIsSpeakingFunction : public ChromeSyncExtensionFunction {
private:
virtual ~TtsIsSpeakingFunction() {}
virtual bool RunImpl() OVERRIDE;
DECLARE_EXTENSION_FUNCTION("tts.isSpeaking", TTS_ISSPEAKING)
};
-class TtsGetVoicesFunction : public SyncExtensionFunction {
+class TtsGetVoicesFunction : public ChromeSyncExtensionFunction {
private:
virtual ~TtsGetVoicesFunction() {}
virtual bool RunImpl() OVERRIDE;
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 50cfe09..b15d040 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -628,6 +628,8 @@
'browser/extensions/browser_permissions_policy_delegate.h',
'browser/extensions/bundle_installer.cc',
'browser/extensions/bundle_installer.h',
+ 'browser/extensions/chrome_extension_function.cc',
+ 'browser/extensions/chrome_extension_function.h',
'browser/extensions/component_loader.cc',
'browser/extensions/component_loader.h',
'browser/extensions/context_menu_matcher.cc',