diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-11 02:10:11 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-11 02:10:11 +0000 |
commit | 4636c837d247f6fa7d4982160643f39d752c2ed5 (patch) | |
tree | db91cc6c57fd3e6f79a2c7d64ec553daabaa6e0d /chrome | |
parent | 0ccf9d61123b5f9494e313dd79db73b658239196 (diff) | |
download | chromium_src-4636c837d247f6fa7d4982160643f39d752c2ed5.zip chromium_src-4636c837d247f6fa7d4982160643f39d752c2ed5.tar.gz chromium_src-4636c837d247f6fa7d4982160643f39d752c2ed5.tar.bz2 |
Run the JSON Schema Compiler's bundle compilation on JSON files. Previously it
was only run on IDL files. Clean up all the code which that simplifies.
TBR=isherman@chromium.org,battre@chromium.org,akalin@chromium.org
BUG=141318
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=176015
Review URL: https://codereview.chromium.org/11747025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
116 files changed, 1287 insertions, 1554 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc index 940a04f..45e8161 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc @@ -10,10 +10,10 @@ // - Display 'save as' dialog using FileSelectorImpl which waits for the user // feedback. // - Once the user selects the file path (or cancels the selection), -// FileSelectorImpl notifies FileHandlerSelectFileFunction of the selection -// result by calling FileHandlerSelectFile::OnFilePathSelected. -// - If the selection was canceled, FileHandlerSelectFileFunction returns -// reporting failure. +// FileSelectorImpl notifies FileBrowserHandlerInternalSelectFileFunction of +// the selection result by calling FileHandlerSelectFile::OnFilePathSelected. +// - If the selection was canceled, +// FileBrowserHandlerInternalSelectFileFunction returns reporting failure. // - If the file path was selected, the function opens external file system // needed to create FileEntry object for the selected path // (opening file system will create file system name and root url for the @@ -119,10 +119,11 @@ class FileSelectorImpl : public FileSelector, // After this method is called, the selector implementation should not be // deleted by the caller. It will delete itself after it receives response // from SelectFielDialog. - virtual void SelectFile(const FilePath& suggested_name, - const std::vector<std::string>& allowed_extensions, - Browser* browser, - FileHandlerSelectFileFunction* function) OVERRIDE; + virtual void SelectFile( + const FilePath& suggested_name, + const std::vector<std::string>& allowed_extensions, + Browser* browser, + FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE; // ui::SelectFileDialog::Listener overrides. virtual void FileSelected(const FilePath& path, @@ -158,7 +159,7 @@ class FileSelectorImpl : public FileSelector, scoped_refptr<ui::SelectFileDialog> dialog_; // Extension function that uses the selector. - scoped_refptr<FileHandlerSelectFileFunction> function_; + scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> function_; DISALLOW_COPY_AND_ASSIGN(FileSelectorImpl); }; @@ -177,7 +178,7 @@ void FileSelectorImpl::SelectFile( const FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, - FileHandlerSelectFileFunction* function) { + FileBrowserHandlerInternalSelectFileFunction* function) { // We will hold reference to the function until it is notified of selection // result. function_ = function; @@ -289,22 +290,25 @@ void RunOpenFileSystemCallback( } // namespace -FileHandlerSelectFileFunction::FileHandlerSelectFileFunction() - : file_selector_factory_(new FileSelectorFactoryImpl()), - user_gesture_check_enabled_(true) { +FileBrowserHandlerInternalSelectFileFunction:: + FileBrowserHandlerInternalSelectFileFunction() + : file_selector_factory_(new FileSelectorFactoryImpl()), + user_gesture_check_enabled_(true) { } -FileHandlerSelectFileFunction::FileHandlerSelectFileFunction( - FileSelectorFactory* file_selector_factory, - bool enable_user_gesture_check) - : file_selector_factory_(file_selector_factory), - user_gesture_check_enabled_(enable_user_gesture_check) { +FileBrowserHandlerInternalSelectFileFunction:: + FileBrowserHandlerInternalSelectFileFunction( + FileSelectorFactory* file_selector_factory, + bool enable_user_gesture_check) + : file_selector_factory_(file_selector_factory), + user_gesture_check_enabled_(enable_user_gesture_check) { DCHECK(file_selector_factory); } -FileHandlerSelectFileFunction::~FileHandlerSelectFileFunction() {} +FileBrowserHandlerInternalSelectFileFunction:: + ~FileBrowserHandlerInternalSelectFileFunction() {} -bool FileHandlerSelectFileFunction::RunImpl() { +bool FileBrowserHandlerInternalSelectFileFunction::RunImpl() { scoped_ptr<SelectFile::Params> params(SelectFile::Params::Create(*args_)); FilePath suggested_name(params->selection_params.suggested_name); @@ -325,7 +329,7 @@ bool FileHandlerSelectFileFunction::RunImpl() { return true; } -void FileHandlerSelectFileFunction::OnFilePathSelected( +void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected( bool success, const FilePath& full_path) { if (!success) { @@ -342,11 +346,12 @@ void FileHandlerSelectFileFunction::OnFilePathSelected( source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false, base::Bind( &RunOpenFileSystemCallback, - base::Bind(&FileHandlerSelectFileFunction::OnFileSystemOpened, + base::Bind(&FileBrowserHandlerInternalSelectFileFunction:: + OnFileSystemOpened, this))); }; -void FileHandlerSelectFileFunction::OnFileSystemOpened( +void FileBrowserHandlerInternalSelectFileFunction::OnFileSystemOpened( bool success, const std::string& file_system_name, const GURL& file_system_root) { @@ -364,7 +369,7 @@ void FileHandlerSelectFileFunction::OnFileSystemOpened( GrantPermissions(); } -void FileHandlerSelectFileFunction::GrantPermissions() { +void FileBrowserHandlerInternalSelectFileFunction::GrantPermissions() { fileapi::ExternalFileSystemMountPointProvider* external_provider = BrowserContext::GetDefaultStoragePartition(profile_)-> GetFileSystemContext()->external_provider(); @@ -400,11 +405,12 @@ void FileHandlerSelectFileFunction::GrantPermissions() { profile(), gdata_paths.Pass(), &permissions_to_grant_, - base::Bind(&FileHandlerSelectFileFunction::OnGotPermissionsToGrant, + base::Bind(&FileBrowserHandlerInternalSelectFileFunction:: + OnGotPermissionsToGrant, this)); } -void FileHandlerSelectFileFunction::OnGotPermissionsToGrant() { +void FileBrowserHandlerInternalSelectFileFunction::OnGotPermissionsToGrant() { // At this point all needed permissions should be collected, so let's grant // them. for (size_t i = 0; i < permissions_to_grant_.size(); i++) { @@ -417,7 +423,7 @@ void FileHandlerSelectFileFunction::OnGotPermissionsToGrant() { Respond(true); } -void FileHandlerSelectFileFunction::Respond(bool success) { +void FileBrowserHandlerInternalSelectFileFunction::Respond(bool success) { scoped_ptr<SelectFile::Results::Result> result( new SelectFile::Results::Result()); result->success = success; diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.h b/chrome/browser/chromeos/extensions/file_browser_handler_api.h index a4a125d..db9a8db 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.h @@ -19,14 +19,14 @@ #include "chrome/browser/extensions/extension_function.h" class Browser; -class FileHandlerSelectFileFunction; +class FileBrowserHandlerInternalSelectFileFunction; namespace file_handler { -// Interface that is used by FileHandlerSelectFileFunction to select the file -// path that should be reported back to the extension function caller. -// Nobody will take the ownership of the interface implementation, so it should -// delete itself once it's done. +// Interface that is used by FileBrowserHandlerInternalSelectFileFunction to +// select the file path that should be reported back to the extension function +// caller. Nobody will take the ownership of the interface implementation, so +// it should delete itself once it's done. class FileSelector { public: virtual ~FileSelector() {} @@ -48,19 +48,21 @@ class FileSelector { // |SelectFile| will be called at most once by a single extension function. // The interface implementation should delete itself after the extension // function is notified of file selection result. - virtual void SelectFile(const FilePath& suggested_name, - const std::vector<std::string>& allowed_extensions, - Browser* browser, - FileHandlerSelectFileFunction* function) = 0; + virtual void SelectFile( + const FilePath& suggested_name, + const std::vector<std::string>& allowed_extensions, + Browser* browser, + FileBrowserHandlerInternalSelectFileFunction* function) = 0; }; -// Interface that is used by FileHandlerSelectFileFunction to create a -// FileSelector it can use to select a file path. +// Interface that is used by FileBrowserHandlerInternalSelectFileFunction to +// create a FileSelector it can use to select a file path. class FileSelectorFactory { public: virtual ~FileSelectorFactory() {} - // Creates a FileSelector instance for the FileHandlerSelectFileFunction. + // Creates a FileSelector instance for the + // FileBrowserHandlerInternalSelectFileFunction. virtual FileSelector* CreateFileSelector() const = 0; }; @@ -68,18 +70,19 @@ class FileSelectorFactory { // The fileBrowserHandlerInternal.selectFile extension function implementation. // See the file description for more info. -class FileHandlerSelectFileFunction : public AsyncExtensionFunction { +class FileBrowserHandlerInternalSelectFileFunction + : public AsyncExtensionFunction { public: // Default constructor used in production code. // It will create its own FileSelectorFactory implementation, and set the // value of |user_gesture_check_enabled| to true. - FileHandlerSelectFileFunction(); + FileBrowserHandlerInternalSelectFileFunction(); // This constructor should be used only in tests to inject test file selector // factory and to allow extension function to run even if it hasn't been // invoked by user gesture. // Created object will take the ownership of the |file_selector_factory|. - FileHandlerSelectFileFunction( + FileBrowserHandlerInternalSelectFileFunction( file_handler::FileSelectorFactory* file_selector_factory, bool enable_user_gesture_check); @@ -93,7 +96,7 @@ class FileHandlerSelectFileFunction : public AsyncExtensionFunction { protected: // The class is ref counted, so destructor should not be public. - virtual ~FileHandlerSelectFileFunction() OVERRIDE; + virtual ~FileBrowserHandlerInternalSelectFileFunction(); // AsyncExtensionFunction implementation. // Runs the extension function implementation. diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc index 5689100..c605ab7 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc @@ -64,7 +64,7 @@ void ExpectFileContentEquals(const FilePath& selected_path, EXPECT_EQ(expected_contents, test_file_contents); } -// Mocks FileSelector used by FileHandlerSelectFileFunction. +// Mocks FileSelector used by FileBrowserHandlerInternalSelectFileFunction. // When |SelectFile| is called, it will check that file name suggestion is as // expected, and respond to the extension function with specified selection // results. @@ -83,10 +83,11 @@ class MockFileSelector : public file_handler::FileSelector { // file_handler::FileSelector implementation. // |browser| is not used. - virtual void SelectFile(const FilePath& suggested_name, - const std::vector<std::string>& allowed_extensions, - Browser* browser, - FileHandlerSelectFileFunction* function) OVERRIDE { + virtual void SelectFile( + const FilePath& suggested_name, + const std::vector<std::string>& allowed_extensions, + Browser* browser, + FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE { // Confirm that the function suggested us the right name. EXPECT_EQ(suggested_name_, suggested_name); // Confirm that the function allowed us the right extensions. @@ -100,8 +101,9 @@ class MockFileSelector : public file_handler::FileSelector { // Send response to the extension function. // The callback will take a reference to the function and keep it alive. base::MessageLoopProxy::current()->PostTask(FROM_HERE, - base::Bind(&FileHandlerSelectFileFunction::OnFilePathSelected, - function, success_, selected_path_)); + base::Bind(&FileBrowserHandlerInternalSelectFileFunction:: + OnFilePathSelected, + function, success_, selected_path_)); delete this; } @@ -182,10 +184,10 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { return tmp_mount_point_.Append(relative_path); } - // Creates a new FileHandlerSelectFileFunction to be used in the test. - // This function will be called from ExtensionFunctinoDispatcher whenever - // an extension function for fileBrowserHandlerInternal.selectFile will be - // needed. + // Creates a new FileBrowserHandlerInternalSelectFileFunction to be used in + // the test. This function will be called from ExtensionFunctinoDispatcher + // whenever an extension function for fileBrowserHandlerInternal.selectFile + // will be needed. static ExtensionFunction* TestSelectFileFunctionFactory() { EXPECT_TRUE(test_cases_); EXPECT_TRUE(current_test_case_ < test_cases_->size()); @@ -193,14 +195,15 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { // If this happens, test failed. But, we still don't want to crash, so // return valid extension function. if (!test_cases_ && current_test_case_ >= test_cases_->size()) - return new FileHandlerSelectFileFunction(); + return new FileBrowserHandlerInternalSelectFileFunction(); // Create file creator factory for the current test case. MockFileSelectorFactory* mock_factory = new MockFileSelectorFactory(test_cases_->at(current_test_case_)); current_test_case_++; - return new FileHandlerSelectFileFunction(mock_factory, false); + return new FileBrowserHandlerInternalSelectFileFunction( + mock_factory, false); } // Sets up test parameters for extension function invocations that will be @@ -289,8 +292,9 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { // Tests that verifies the fileBrowserHandlerInternal.selectFile function fails // when invoked without user gesture. IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, NoUserGesture) { - scoped_refptr<FileHandlerSelectFileFunction> select_file_function( - new FileHandlerSelectFileFunction()); + scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> + select_file_function( + new FileBrowserHandlerInternalSelectFileFunction()); std::string error = utils::RunFunctionAndReturnError( @@ -313,9 +317,11 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SelectionFailed) { false, FilePath()); - scoped_refptr<FileHandlerSelectFileFunction> select_file_function( - new FileHandlerSelectFileFunction(new MockFileSelectorFactory(test_case), - false)); + scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> + select_file_function( + new FileBrowserHandlerInternalSelectFileFunction( + new MockFileSelectorFactory(test_case), + false)); select_file_function->set_has_callback(true); select_file_function->set_user_gesture(true); @@ -340,9 +346,11 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SuggestedFullPath) { false, FilePath()); - scoped_refptr<FileHandlerSelectFileFunction> select_file_function( - new FileHandlerSelectFileFunction(new MockFileSelectorFactory(test_case), - false)); + scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> + select_file_function( + new FileBrowserHandlerInternalSelectFileFunction( + new MockFileSelectorFactory(test_case), + false)); select_file_function->set_has_callback(true); select_file_function->set_user_gesture(true); diff --git a/chrome/browser/extensions/api/README.txt b/chrome/browser/extensions/api/README.txt index 74d72d6..8f767ef 100644 --- a/chrome/browser/extensions/api/README.txt +++ b/chrome/browser/extensions/api/README.txt @@ -19,23 +19,15 @@ Create "chrome/common/extensions/api/experimental_foo.json". For inspiration look at the "app" API. Include descriptions fields to generate the documentation. -2) Add your API specification to extensions_api_resources.grd. -Add an "<include ...>" line with your JSON specification file to -"chrome/common/extensions_api_resources.grd". - -3) Add your API specification to api.gyp. -Add "experimental_foo.json" to the "json_schema_files" section in +2) Add your API specification to api.gyp. +Add "experimental_foo.json" to the "schema_files" section in "chrome/common/extensions/api/api.gyp". -4) Write the API function handlers. +3) Write the API function handlers. Create foo_api.cc and foo_api.h under "chrome/browser/extensions/api/foo". You should use the JSON Schema Compiler. Look at the "permissions_api.cc" for details on how to do that. -5) Register function handlers. -In "chrome/browser/extensions/extension_function_registry.cc" include foo_api.h -and instantiate a RegisterFunction for each function you created in (3). - -------------------------------------------------------------------------------- APPROACH 2: IDL FILES @@ -45,7 +37,7 @@ at "alarms.idl". Include comments, they will be used to automatically generate the documentation. 2) Add your API specification to api.gyp. -Add "experimental_foo.idl" to the "idl_schema_files" section in +Add "experimental_foo.idl" to the "schema_files" section in "chrome/common/extensions/api/api.gyp". 3) Write the API function handlers. @@ -53,8 +45,6 @@ Create foo_api.cc and foo_api.h under "chrome/browser/extensions/api/foo". You should use the JSON Schema Compiler. Look at the "alarms_api.cc" for details on how to do that. -4-5) Nothing to do! Function handlers are automatically registered for you. - -------------------------------------------------------------------------------- STEPS COMMON TO BOTH APPROACHES @@ -70,32 +60,10 @@ The files you created in (3) and (5) should be added to -------------------------------------------------------------------------------- GENERATING DOCUMENTATION -8) Build the project. (Only required if you used IDL files.) -If you used IDL files, you need to build the project once in order for the -documentation to be properly generated. Do this now. (This is required in order -to generate the JSON file used to generate documentation.) - -9) Add your JSON file to the documentation controller -Open "chrome/common/extensions/docs/js/api_page_generator.js" and add a line -referring to "../api/experimental_foo.json". Do this even if you used the IDL -approach as this JSON file has been generated in (7). - -10) Write the static HTML page. -Write a small snippet of static HTML describing your API in -"chrome/common/extensions/docs/static/experimental.foo.html". For the moment, -just include the following in this file, adjusting it to describe your API: - - <div id="pageData-name" class="pageData">Experimental Foo APIs</div> - - <!-- BEGIN AUTHORED CONTENT --> - <p>The current methods allow applications to...</p> - <!-- END AUTHORED CONTENT --> +8) Add a stub template in ../docs/templates/public corresponding to your API. +See other templates for inspiration. -11) Build the documentation. -You will need to build DumpRenderTree once before you can build the -documentation. Once this is done, from "chrome/common/extensions/docs" run -"build/build.py". For more information on building documentation see README.txt -in "chrome/common/extensions/docs". +9) Run ../docs/templates/server2/preview.py to view the generated documentation. -------------------------------------------------------------------------------- WRITING TESTS 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 6e48b67..8f736a5 100644 --- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc +++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc @@ -88,12 +88,6 @@ bool AutotestPrivateLoginStatusFunction::RunImpl() { } AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { - ExtensionFunctionRegistry* registry = - ExtensionFunctionRegistry::GetInstance(); - registry->RegisterFunction<AutotestPrivateLogoutFunction>(); - registry->RegisterFunction<AutotestPrivateRestartFunction>(); - registry->RegisterFunction<AutotestPrivateShutdownFunction>(); - registry->RegisterFunction<AutotestPrivateLoginStatusFunction>(); } AutotestPrivateAPI::~AutotestPrivateAPI() { diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc index c3e3a65..a245283 100644 --- a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc @@ -449,8 +449,8 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevicesError) { } IN_PROC_BROWSER_TEST_F(BluetoothApiTest, Permissions) { - RequestPermissionsFunction::SetAutoConfirmForTests(true); - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetAutoConfirmForTests(true); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); EXPECT_CALL(*mock_adapter_, GetDevice(device1_->address())) .WillOnce(testing::Return(device1_.get())); 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 0ed0bb2..77b5850 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 @@ -7,7 +7,7 @@ #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" -#include "chrome/browser/extensions/api/bookmarks/bookmark_api.h" +#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_api_factory.cc b/chrome/browser/extensions/api/bookmarks/bookmark_api_factory.cc index 3f20629..9c649bb 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmark_api_factory.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmark_api_factory.cc @@ -4,7 +4,7 @@ #include "chrome/browser/extensions/api/bookmarks/bookmark_api_factory.h" -#include "chrome/browser/extensions/api/bookmarks/bookmark_api.h" +#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" #include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/profiles/profile_dependency_manager.h" diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index c076813..08fa4ab3 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmark_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/bookmarks/bookmark_api.h" +#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" #include "base/bind.h" #include "base/file_path.h" @@ -303,7 +303,7 @@ void BookmarkAPI::OnListenerAdded(const EventListenerInfo& details) { ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); } -bool GetBookmarksFunction::RunImpl() { +bool BookmarksGetTreeFunction::RunImpl() { scoped_ptr<bookmarks::Get::Params> params( bookmarks::Get::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -343,7 +343,7 @@ bool GetBookmarksFunction::RunImpl() { return true; } -bool GetBookmarkChildrenFunction::RunImpl() { +bool BookmarksGetChildrenFunction::RunImpl() { scoped_ptr<bookmarks::GetChildren::Params> params( bookmarks::GetChildren::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -369,7 +369,7 @@ bool GetBookmarkChildrenFunction::RunImpl() { return true; } -bool GetBookmarkRecentFunction::RunImpl() { +bool BookmarksGetFunction::RunImpl() { scoped_ptr<bookmarks::GetRecent::Params> params( bookmarks::GetRecent::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -393,7 +393,7 @@ bool GetBookmarkRecentFunction::RunImpl() { return true; } -bool GetBookmarkTreeFunction::RunImpl() { +bool BookmarksGetSubTreeFunction::RunImpl() { std::vector<linked_ptr<BookmarkTreeNode> > nodes; const BookmarkNode* node = BookmarkModelFactory::GetForProfile(profile())->root_node(); @@ -402,7 +402,7 @@ bool GetBookmarkTreeFunction::RunImpl() { return true; } -bool GetBookmarkSubTreeFunction::RunImpl() { +bool BookmarksGetRecentFunction::RunImpl() { scoped_ptr<bookmarks::GetSubTree::Params> params( bookmarks::GetSubTree::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -424,7 +424,7 @@ bool GetBookmarkSubTreeFunction::RunImpl() { return true; } -bool SearchBookmarksFunction::RunImpl() { +bool BookmarksSearchFunction::RunImpl() { scoped_ptr<bookmarks::Search::Params> params( bookmarks::Search::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -450,7 +450,7 @@ bool SearchBookmarksFunction::RunImpl() { } // static -bool RemoveBookmarkFunction::ExtractIds(const ListValue* args, +bool BookmarksRemoveFunction::ExtractIds(const ListValue* args, std::list<int64>* ids, bool* invalid_id) { std::string id_string; @@ -464,7 +464,7 @@ bool RemoveBookmarkFunction::ExtractIds(const ListValue* args, return true; } -bool RemoveBookmarkFunction::RunImpl() { +bool BookmarksRemoveFunction::RunImpl() { if (!EditBookmarksEnabled()) return false; @@ -479,7 +479,7 @@ bool RemoveBookmarkFunction::RunImpl() { } bool recursive = false; - if (name() == RemoveTreeBookmarkFunction::function_name()) + if (name() == BookmarksRemoveTreeFunction::function_name()) recursive = true; BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); @@ -489,7 +489,7 @@ bool RemoveBookmarkFunction::RunImpl() { return true; } -bool CreateBookmarkFunction::RunImpl() { +bool BookmarksCreateFunction::RunImpl() { if (!EditBookmarksEnabled()) return false; @@ -561,14 +561,14 @@ bool CreateBookmarkFunction::RunImpl() { } // static -bool MoveBookmarkFunction::ExtractIds(const ListValue* args, +bool BookmarksMoveFunction::ExtractIds(const ListValue* args, std::list<int64>* ids, bool* invalid_id) { // For now, Move accepts ID parameters in the same way as an Update. - return UpdateBookmarkFunction::ExtractIds(args, ids, invalid_id); + return BookmarksUpdateFunction::ExtractIds(args, ids, invalid_id); } -bool MoveBookmarkFunction::RunImpl() { +bool BookmarksMoveFunction::RunImpl() { if (!EditBookmarksEnabled()) return false; @@ -635,14 +635,14 @@ bool MoveBookmarkFunction::RunImpl() { } // static -bool UpdateBookmarkFunction::ExtractIds(const ListValue* args, +bool BookmarksUpdateFunction::ExtractIds(const ListValue* args, std::list<int64>* ids, bool* invalid_id) { // For now, Update accepts ID parameters in the same way as an Remove. - return RemoveBookmarkFunction::ExtractIds(args, ids, invalid_id); + return BookmarksRemoveFunction::ExtractIds(args, ids, invalid_id); } -bool UpdateBookmarkFunction::RunImpl() { +bool BookmarksUpdateFunction::RunImpl() { if (!EditBookmarksEnabled()) return false; @@ -719,7 +719,7 @@ class BookmarkBucketMapper : public BucketMapper { class CreateBookmarkBucketMapper : public BookmarkBucketMapper<std::string> { public: explicit CreateBookmarkBucketMapper(Profile* profile) : profile_(profile) {} - // TODO(tim): This should share code with CreateBookmarkFunction::RunImpl, + // TODO(tim): This should share code with BookmarksCreateFunction::RunImpl, // but I can't figure out a good way to do that with all the macros. virtual void GetBucketsForArgs(const ListValue* args, BucketList* buckets) { const DictionaryValue* json; @@ -763,7 +763,7 @@ class RemoveBookmarksBucketMapper : public BookmarkBucketMapper<std::string> { typedef std::list<int64> IdList; IdList ids; bool invalid_id = false; - if (!RemoveBookmarkFunction::ExtractIds(args, &ids, &invalid_id) || + if (!BookmarksRemoveFunction::ExtractIds(args, &ids, &invalid_id) || invalid_id) { return; } @@ -856,22 +856,22 @@ class BookmarksQuotaLimitFactory { }; // And finally, building the individual heuristics for each function. -void RemoveBookmarkFunction::GetQuotaLimitHeuristics( +void BookmarksRemoveFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { BookmarksQuotaLimitFactory::BuildForRemove(heuristics, profile()); } -void MoveBookmarkFunction::GetQuotaLimitHeuristics( +void BookmarksMoveFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { - BookmarksQuotaLimitFactory::Build<MoveBookmarkFunction>(heuristics); + BookmarksQuotaLimitFactory::Build<BookmarksMoveFunction>(heuristics); } -void UpdateBookmarkFunction::GetQuotaLimitHeuristics( +void BookmarksUpdateFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { - BookmarksQuotaLimitFactory::Build<UpdateBookmarkFunction>(heuristics); + BookmarksQuotaLimitFactory::Build<BookmarksUpdateFunction>(heuristics); }; -void CreateBookmarkFunction::GetQuotaLimitHeuristics( +void BookmarksCreateFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { BookmarksQuotaLimitFactory::BuildForCreate(heuristics, profile()); } @@ -949,14 +949,14 @@ void BookmarksIOFunction::MultiFilesSelected( NOTREACHED() << "Should not be able to select multiple files"; } -bool ImportBookmarksFunction::RunImpl() { +bool BookmarksImportFunction::RunImpl() { if (!EditBookmarksEnabled()) return false; SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE); return true; } -void ImportBookmarksFunction::FileSelected(const FilePath& path, +void BookmarksImportFunction::FileSelected(const FilePath& path, int index, void* params) { #if !defined(OS_ANDROID) @@ -976,12 +976,12 @@ void ImportBookmarksFunction::FileSelected(const FilePath& path, Release(); // Balanced in BookmarksIOFunction::SelectFile() } -bool ExportBookmarksFunction::RunImpl() { +bool BookmarksExportFunction::RunImpl() { SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE); return true; } -void ExportBookmarksFunction::FileSelected(const FilePath& path, +void BookmarksExportFunction::FileSelected(const FilePath& path, int index, void* params) { #if !defined(OS_ANDROID) diff --git a/chrome/browser/extensions/api/bookmarks/bookmark_api.h b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h index c3008246..0d2a240 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmark_api.h +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ #include <list> #include <string> @@ -116,73 +116,73 @@ class BookmarksFunction : public AsyncExtensionFunction, content::NotificationRegistrar registrar_; }; -class GetBookmarksFunction : public BookmarksFunction { +class BookmarksGetTreeFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.get") protected: - virtual ~GetBookmarksFunction() {} + virtual ~BookmarksGetTreeFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetBookmarkChildrenFunction : public BookmarksFunction { +class BookmarksGetChildrenFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getChildren") protected: - virtual ~GetBookmarkChildrenFunction() {} + virtual ~BookmarksGetChildrenFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetBookmarkRecentFunction : public BookmarksFunction { +class BookmarksGetFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getRecent") protected: - virtual ~GetBookmarkRecentFunction() {} + virtual ~BookmarksGetFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetBookmarkTreeFunction : public BookmarksFunction { +class BookmarksGetSubTreeFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getTree") protected: - virtual ~GetBookmarkTreeFunction() {} + virtual ~BookmarksGetSubTreeFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetBookmarkSubTreeFunction : public BookmarksFunction { +class BookmarksGetRecentFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getSubTree") protected: - virtual ~GetBookmarkSubTreeFunction() {} + virtual ~BookmarksGetRecentFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class SearchBookmarksFunction : public BookmarksFunction { +class BookmarksSearchFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.search") protected: - virtual ~SearchBookmarksFunction() {} + virtual ~BookmarksSearchFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class RemoveBookmarkFunction : public BookmarksFunction { +class BookmarksRemoveFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.remove") @@ -195,21 +195,21 @@ class RemoveBookmarkFunction : public BookmarksFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; protected: - virtual ~RemoveBookmarkFunction() {} + virtual ~BookmarksRemoveFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class RemoveTreeBookmarkFunction : public RemoveBookmarkFunction { +class BookmarksRemoveTreeFunction : public BookmarksRemoveFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.removeTree") protected: - virtual ~RemoveTreeBookmarkFunction() {} + virtual ~BookmarksRemoveTreeFunction() {} }; -class CreateBookmarkFunction : public BookmarksFunction { +class BookmarksCreateFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.create") @@ -218,13 +218,13 @@ class CreateBookmarkFunction : public BookmarksFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; protected: - virtual ~CreateBookmarkFunction() {} + virtual ~BookmarksCreateFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class MoveBookmarkFunction : public BookmarksFunction { +class BookmarksMoveFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.move") @@ -236,13 +236,13 @@ class MoveBookmarkFunction : public BookmarksFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; protected: - virtual ~MoveBookmarkFunction() {} + virtual ~BookmarksMoveFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class UpdateBookmarkFunction : public BookmarksFunction { +class BookmarksUpdateFunction : public BookmarksFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.update") @@ -254,7 +254,7 @@ class UpdateBookmarkFunction : public BookmarksFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; protected: - virtual ~UpdateBookmarkFunction() {} + virtual ~BookmarksUpdateFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -286,7 +286,7 @@ class BookmarksIOFunction : public BookmarksFunction, scoped_refptr<ui::SelectFileDialog> select_file_dialog_; }; -class ImportBookmarksFunction : public BookmarksIOFunction { +class BookmarksImportFunction : public BookmarksIOFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.import"); @@ -295,13 +295,13 @@ class ImportBookmarksFunction : public BookmarksIOFunction { OVERRIDE; private: - virtual ~ImportBookmarksFunction() {} + virtual ~BookmarksImportFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class ExportBookmarksFunction : public BookmarksIOFunction { +class BookmarksExportFunction : public BookmarksIOFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.export"); @@ -310,7 +310,7 @@ class ExportBookmarksFunction : public BookmarksIOFunction { OVERRIDE; private: - virtual ~ExportBookmarksFunction() {} + virtual ~BookmarksExportFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -318,4 +318,4 @@ class ExportBookmarksFunction : public BookmarksIOFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ 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 2bb3a84..0c77b09 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 @@ -31,14 +31,16 @@ CloudPrintTestsDelegate::~CloudPrintTestsDelegate() { instance_ = NULL; } -CloudPrintSetupConnectorFunction::CloudPrintSetupConnectorFunction() { +CloudPrintPrivateSetupConnectorFunction:: + CloudPrintPrivateSetupConnectorFunction() { } -CloudPrintSetupConnectorFunction::~CloudPrintSetupConnectorFunction() { +CloudPrintPrivateSetupConnectorFunction:: + ~CloudPrintPrivateSetupConnectorFunction() { } -bool CloudPrintSetupConnectorFunction::RunImpl() { +bool CloudPrintPrivateSetupConnectorFunction::RunImpl() { using extensions::api::cloud_print_private::SetupConnector::Params; scoped_ptr<Params> params(Params::Create(*args_)); if (CloudPrintTestsDelegate::instance()) { @@ -60,13 +62,13 @@ bool CloudPrintSetupConnectorFunction::RunImpl() { return true; } -CloudPrintGetHostNameFunction::CloudPrintGetHostNameFunction() { +CloudPrintPrivateGetHostNameFunction::CloudPrintPrivateGetHostNameFunction() { } -CloudPrintGetHostNameFunction::~CloudPrintGetHostNameFunction() { +CloudPrintPrivateGetHostNameFunction::~CloudPrintPrivateGetHostNameFunction() { } -bool CloudPrintGetHostNameFunction::RunImpl() { +bool CloudPrintPrivateGetHostNameFunction::RunImpl() { SetResult(Value::CreateStringValue( CloudPrintTestsDelegate::instance() ? CloudPrintTestsDelegate::instance()->GetHostName() : @@ -75,19 +77,19 @@ bool CloudPrintGetHostNameFunction::RunImpl() { return true; } -CloudPrintGetPrintersFunction::CloudPrintGetPrintersFunction() { +CloudPrintPrivateGetPrintersFunction::CloudPrintPrivateGetPrintersFunction() { } -CloudPrintGetPrintersFunction::~CloudPrintGetPrintersFunction() { +CloudPrintPrivateGetPrintersFunction::~CloudPrintPrivateGetPrintersFunction() { } -void CloudPrintGetPrintersFunction::ReturnResult( +void CloudPrintPrivateGetPrintersFunction::ReturnResult( const base::ListValue* printers) { SetResult(printers->DeepCopy()); SendResponse(true); } -void CloudPrintGetPrintersFunction::CollectPrinters() { +void CloudPrintPrivateGetPrintersFunction::CollectPrinters() { scoped_ptr<base::ListValue> result(new base::ListValue()); if (CloudPrintTestsDelegate::instance()) { std::vector<std::string> printers = @@ -104,14 +106,14 @@ void CloudPrintGetPrintersFunction::CollectPrinters() { result->Append(Value::CreateStringValue(printers[i].printer_name)); } content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(&CloudPrintGetPrintersFunction::ReturnResult, this, + base::Bind(&CloudPrintPrivateGetPrintersFunction::ReturnResult, this, base::Owned(result.release()))); } -bool CloudPrintGetPrintersFunction::RunImpl() { +bool CloudPrintPrivateGetPrintersFunction::RunImpl() { content::BrowserThread::GetBlockingPool()->PostTask(FROM_HERE, - base::Bind(&CloudPrintGetPrintersFunction::CollectPrinters, this)); + base::Bind(&CloudPrintPrivateGetPrintersFunction::CollectPrinters, this)); return true; } 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 2a23b9e..030bf67 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 @@ -36,40 +36,40 @@ class CloudPrintTestsDelegate { static CloudPrintTestsDelegate* instance_; }; -class CloudPrintSetupConnectorFunction : public AsyncExtensionFunction { +class CloudPrintPrivateSetupConnectorFunction : public AsyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.setupConnector"); - CloudPrintSetupConnectorFunction(); + CloudPrintPrivateSetupConnectorFunction(); protected: - virtual ~CloudPrintSetupConnectorFunction(); + virtual ~CloudPrintPrivateSetupConnectorFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class CloudPrintGetHostNameFunction : public AsyncExtensionFunction { +class CloudPrintPrivateGetHostNameFunction : public AsyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getHostName"); - CloudPrintGetHostNameFunction(); + CloudPrintPrivateGetHostNameFunction(); protected: - virtual ~CloudPrintGetHostNameFunction(); + virtual ~CloudPrintPrivateGetHostNameFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class CloudPrintGetPrintersFunction : public AsyncExtensionFunction { +class CloudPrintPrivateGetPrintersFunction : public AsyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cloudPrintPrivate.getPrinters"); - CloudPrintGetPrintersFunction(); + CloudPrintPrivateGetPrintersFunction(); protected: - virtual ~CloudPrintGetPrintersFunction(); + virtual ~CloudPrintPrivateGetPrintersFunction(); void CollectPrinters(); void ReturnResult(const base::ListValue* printers); 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 87c1798..e1c4a08 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_api.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_api.cc @@ -62,7 +62,7 @@ namespace extensions { namespace helpers = content_settings_helpers; namespace keys = content_settings_api_constants; -bool ClearContentSettingsFunction::RunImpl() { +bool ContentSettingsClearFunction::RunImpl() { ContentSettingsType content_type; EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); @@ -96,7 +96,7 @@ bool ClearContentSettingsFunction::RunImpl() { return true; } -bool GetContentSettingFunction::RunImpl() { +bool ContentSettingsGetFunction::RunImpl() { ContentSettingsType content_type; EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); @@ -169,7 +169,7 @@ bool GetContentSettingFunction::RunImpl() { return true; } -bool SetContentSettingFunction::RunImpl() { +bool ContentSettingsSetFunction::RunImpl() { ContentSettingsType content_type; EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); @@ -250,7 +250,7 @@ bool SetContentSettingFunction::RunImpl() { return true; } -bool GetResourceIdentifiersFunction::RunImpl() { +bool ContentSettingsGetResourceIdentifiersFunction::RunImpl() { ContentSettingsType content_type; EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); @@ -261,14 +261,15 @@ bool GetResourceIdentifiersFunction::RunImpl() { if (!g_testing_plugins_) { PluginService::GetInstance()->GetPlugins( - base::Bind(&GetResourceIdentifiersFunction::OnGotPlugins, this)); + base::Bind(&ContentSettingsGetResourceIdentifiersFunction::OnGotPlugins, + this)); } else { OnGotPlugins(*g_testing_plugins_); } return true; } -void GetResourceIdentifiersFunction::OnGotPlugins( +void ContentSettingsGetResourceIdentifiersFunction::OnGotPlugins( const std::vector<webkit::WebPluginInfo>& plugins) { PluginFinder* finder = PluginFinder::GetInstance(); std::set<std::string> group_identifiers; @@ -289,11 +290,13 @@ void GetResourceIdentifiersFunction::OnGotPlugins( SetResult(list); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind( - &GetResourceIdentifiersFunction::SendResponse, this, true)); + &ContentSettingsGetResourceIdentifiersFunction::SendResponse, + this, + true)); } // static -void GetResourceIdentifiersFunction::SetPluginsForTesting( +void ContentSettingsGetResourceIdentifiersFunction::SetPluginsForTesting( const std::vector<webkit::WebPluginInfo>* plugins) { g_testing_plugins_ = plugins; } 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 20ffcc7..aac0b81 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_api.h +++ b/chrome/browser/extensions/api/content_settings/content_settings_api.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_H__ -#define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_H__ +#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" @@ -15,45 +15,46 @@ struct WebPluginInfo; namespace extensions { -class ClearContentSettingsFunction : public SyncExtensionFunction { +class ContentSettingsClearFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contentSettings.clear") protected: - virtual ~ClearContentSettingsFunction() {} + virtual ~ContentSettingsClearFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetContentSettingFunction : public SyncExtensionFunction { +class ContentSettingsGetFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contentSettings.get") protected: - virtual ~GetContentSettingFunction() {} + virtual ~ContentSettingsGetFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class SetContentSettingFunction : public SyncExtensionFunction { +class ContentSettingsSetFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contentSettings.set") protected: - virtual ~SetContentSettingFunction() {} + virtual ~ContentSettingsSetFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetResourceIdentifiersFunction : public AsyncExtensionFunction { +class ContentSettingsGetResourceIdentifiersFunction + : public AsyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contentSettings.getResourceIdentifiers") protected: - virtual ~GetResourceIdentifiersFunction() {} + virtual ~ContentSettingsGetResourceIdentifiersFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -73,4 +74,4 @@ class GetResourceIdentifiersFunction : public AsyncExtensionFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_H__ +#endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_API_H_ diff --git a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc index 69227d1..381346e 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include "base/utf_string_conversions.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_api.h" #include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/host_content_settings_map.h" +#include "chrome/browser/extensions/api/content_settings/content_settings_api.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" @@ -120,12 +120,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, std::vector<webkit::WebPluginInfo> plugins; plugin_list.GetPlugins(&plugins); - GetResourceIdentifiersFunction::SetPluginsForTesting(&plugins); + ContentSettingsGetResourceIdentifiersFunction::SetPluginsForTesting(&plugins); EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) << message_; - GetResourceIdentifiersFunction::SetPluginsForTesting(NULL); + ContentSettingsGetResourceIdentifiersFunction::SetPluginsForTesting(NULL); } } // namespace extensions diff --git a/chrome/browser/extensions/api/context_menu/context_menu_apitest.cc b/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc index 85d2441..85d2441 100644 --- a/chrome/browser/extensions/api/context_menu/context_menu_apitest.cc +++ b/chrome/browser/extensions/api/context_menus/context_menu_apitest.cc diff --git a/chrome/browser/extensions/api/context_menu/context_menu_api.cc b/chrome/browser/extensions/api/context_menus/context_menus_api.cc index 0d98897..45f4264 100644 --- a/chrome/browser/extensions/api/context_menu/context_menu_api.cc +++ b/chrome/browser/extensions/api/context_menus/context_menus_api.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/context_menu/context_menu_api.h" +#include "chrome/browser/extensions/api/context_menus/context_menus_api.h" #include <string> @@ -150,7 +150,7 @@ namespace Create = api::context_menus::Create; namespace Remove = api::context_menus::Remove; namespace Update = api::context_menus::Update; -bool CreateContextMenuFunction::RunImpl() { +bool ContextMenusCreateFunction::RunImpl() { MenuItem::Id id(profile()->IsOffTheRecord(), extension_id()); scoped_ptr<Create::Params> params(Create::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -245,7 +245,7 @@ bool CreateContextMenuFunction::RunImpl() { return true; } -bool UpdateContextMenuFunction::RunImpl() { +bool ContextMenusUpdateFunction::RunImpl() { bool radio_item_updated = false; MenuItem::Id item_id(profile()->IsOffTheRecord(), extension_id()); scoped_ptr<Update::Params> params(Update::Params::Create(*args_)); @@ -354,7 +354,7 @@ bool UpdateContextMenuFunction::RunImpl() { return true; } -bool RemoveContextMenuFunction::RunImpl() { +bool ContextMenusRemoveFunction::RunImpl() { scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -387,7 +387,7 @@ bool RemoveContextMenuFunction::RunImpl() { return true; } -bool RemoveAllContextMenusFunction::RunImpl() { +bool ContextMenusRemoveAllFunction::RunImpl() { ExtensionService* service = profile()->GetExtensionService(); MenuManager* manager = service->menu_manager(); manager->RemoveAllContextItems(GetExtension()->id()); diff --git a/chrome/browser/extensions/api/context_menu/context_menu_api.h b/chrome/browser/extensions/api/context_menus/context_menus_api.h index 5f15c92..d6b1217 100644 --- a/chrome/browser/extensions/api/context_menu/context_menu_api.h +++ b/chrome/browser/extensions/api/context_menus/context_menus_api.h @@ -2,52 +2,52 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__ -#define CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__ +#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" namespace extensions { -class CreateContextMenuFunction : public SyncExtensionFunction { +class ContextMenusCreateFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.create") protected: - virtual ~CreateContextMenuFunction() {} + virtual ~ContextMenusCreateFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class UpdateContextMenuFunction : public SyncExtensionFunction { +class ContextMenusUpdateFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.update") protected: - virtual ~UpdateContextMenuFunction() {} + virtual ~ContextMenusUpdateFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class RemoveContextMenuFunction : public SyncExtensionFunction { +class ContextMenusRemoveFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.remove") protected: - virtual ~RemoveContextMenuFunction() {} + virtual ~ContextMenusRemoveFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class RemoveAllContextMenusFunction : public SyncExtensionFunction { +class ContextMenusRemoveAllFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("contextMenus.removeAll") protected: - virtual ~RemoveAllContextMenusFunction() {} + virtual ~ContextMenusRemoveAllFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -55,4 +55,4 @@ class RemoveAllContextMenusFunction : public SyncExtensionFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENU_CONTEXT_MENU_API_H__ +#endif // CHROME_BROWSER_EXTENSIONS_API_CONTEXT_MENUS_CONTEXT_MENUS_API_H_ diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc index 1a34a18..26d401e 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc @@ -189,13 +189,13 @@ bool CookiesFunction::ParseStoreContext( return true; } -GetCookieFunction::GetCookieFunction() { +CookiesGetFunction::CookiesGetFunction() { } -GetCookieFunction::~GetCookieFunction() { +CookiesGetFunction::~CookiesGetFunction() { } -bool GetCookieFunction::RunImpl() { +bool CookiesGetFunction::RunImpl() { parsed_args_ = Get::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); @@ -216,23 +216,23 @@ bool GetCookieFunction::RunImpl() { bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&GetCookieFunction::GetCookieOnIOThread, this)); + base::Bind(&CookiesGetFunction::GetCookieOnIOThread, this)); DCHECK(rv); // Will finish asynchronously. return true; } -void GetCookieFunction::GetCookieOnIOThread() { +void CookiesGetFunction::GetCookieOnIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); net::CookieStore* cookie_store = store_context_->GetURLRequestContext()->cookie_store(); cookies_helpers::GetCookieListFromStore( cookie_store, url_, - base::Bind(&GetCookieFunction::GetCookieCallback, this)); + base::Bind(&CookiesGetFunction::GetCookieCallback, this)); } -void GetCookieFunction::GetCookieCallback(const net::CookieList& cookie_list) { +void CookiesGetFunction::GetCookieCallback(const net::CookieList& cookie_list) { net::CookieList::const_iterator it; for (it = cookie_list.begin(); it != cookie_list.end(); ++it) { // Return the first matching cookie. Relies on the fact that the @@ -252,22 +252,22 @@ void GetCookieFunction::GetCookieCallback(const net::CookieList& cookie_list) { bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&GetCookieFunction::RespondOnUIThread, this)); + base::Bind(&CookiesGetFunction::RespondOnUIThread, this)); DCHECK(rv); } -void GetCookieFunction::RespondOnUIThread() { +void CookiesGetFunction::RespondOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); SendResponse(true); } -GetAllCookiesFunction::GetAllCookiesFunction() { +CookiesGetAllFunction::CookiesGetAllFunction() { } -GetAllCookiesFunction::~GetAllCookiesFunction() { +CookiesGetAllFunction::~CookiesGetAllFunction() { } -bool GetAllCookiesFunction::RunImpl() { +bool CookiesGetAllFunction::RunImpl() { parsed_args_ = GetAll::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); @@ -287,23 +287,23 @@ bool GetAllCookiesFunction::RunImpl() { bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&GetAllCookiesFunction::GetAllCookiesOnIOThread, this)); + base::Bind(&CookiesGetAllFunction::GetAllCookiesOnIOThread, this)); DCHECK(rv); // Will finish asynchronously. return true; } -void GetAllCookiesFunction::GetAllCookiesOnIOThread() { +void CookiesGetAllFunction::GetAllCookiesOnIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); net::CookieStore* cookie_store = store_context_->GetURLRequestContext()->cookie_store(); cookies_helpers::GetCookieListFromStore( cookie_store, url_, - base::Bind(&GetAllCookiesFunction::GetAllCookiesCallback, this)); + base::Bind(&CookiesGetAllFunction::GetAllCookiesCallback, this)); } -void GetAllCookiesFunction::GetAllCookiesCallback( +void CookiesGetAllFunction::GetAllCookiesCallback( const net::CookieList& cookie_list) { const extensions::Extension* extension = GetExtension(); if (extension) { @@ -316,22 +316,22 @@ void GetAllCookiesFunction::GetAllCookiesCallback( } bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&GetAllCookiesFunction::RespondOnUIThread, this)); + base::Bind(&CookiesGetAllFunction::RespondOnUIThread, this)); DCHECK(rv); } -void GetAllCookiesFunction::RespondOnUIThread() { +void CookiesGetAllFunction::RespondOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); SendResponse(true); } -SetCookieFunction::SetCookieFunction() : success_(false) { +CookiesSetFunction::CookiesSetFunction() : success_(false) { } -SetCookieFunction::~SetCookieFunction() { +CookiesSetFunction::~CookiesSetFunction() { } -bool SetCookieFunction::RunImpl() { +bool CookiesSetFunction::RunImpl() { parsed_args_ = Set::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); @@ -350,14 +350,14 @@ bool SetCookieFunction::RunImpl() { bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&SetCookieFunction::SetCookieOnIOThread, this)); + base::Bind(&CookiesSetFunction::SetCookieOnIOThread, this)); DCHECK(rv); // Will finish asynchronously. return true; } -void SetCookieFunction::SetCookieOnIOThread() { +void CookiesSetFunction::SetCookieOnIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); net::CookieMonster* cookie_monster = store_context_->GetURLRequestContext()->cookie_store()-> @@ -385,10 +385,10 @@ void SetCookieFunction::SetCookieOnIOThread() { parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only : false, - base::Bind(&SetCookieFunction::PullCookie, this)); + base::Bind(&CookiesSetFunction::PullCookie, this)); } -void SetCookieFunction::PullCookie(bool set_cookie_result) { +void CookiesSetFunction::PullCookie(bool set_cookie_result) { // Pull the newly set cookie. net::CookieMonster* cookie_monster = store_context_->GetURLRequestContext()->cookie_store()-> @@ -396,10 +396,11 @@ void SetCookieFunction::PullCookie(bool set_cookie_result) { success_ = set_cookie_result; cookies_helpers::GetCookieListFromStore( cookie_monster, url_, - base::Bind(&SetCookieFunction::PullCookieCallback, this)); + base::Bind(&CookiesSetFunction::PullCookieCallback, this)); } -void SetCookieFunction::PullCookieCallback(const net::CookieList& cookie_list) { +void CookiesSetFunction::PullCookieCallback( + const net::CookieList& cookie_list) { net::CookieList::const_iterator it; for (it = cookie_list.begin(); it != cookie_list.end(); ++it) { // Return the first matching cookie. Relies on the fact that the @@ -417,11 +418,11 @@ void SetCookieFunction::PullCookieCallback(const net::CookieList& cookie_list) { bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&SetCookieFunction::RespondOnUIThread, this)); + base::Bind(&CookiesSetFunction::RespondOnUIThread, this)); DCHECK(rv); } -void SetCookieFunction::RespondOnUIThread() { +void CookiesSetFunction::RespondOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!success_) { std::string name = parsed_args_->details.name.get() ? @@ -432,13 +433,13 @@ void SetCookieFunction::RespondOnUIThread() { SendResponse(success_); } -RemoveCookieFunction::RemoveCookieFunction() { +CookiesRemoveFunction::CookiesRemoveFunction() { } -RemoveCookieFunction::~RemoveCookieFunction() { +CookiesRemoveFunction::~CookiesRemoveFunction() { } -bool RemoveCookieFunction::RunImpl() { +bool CookiesRemoveFunction::RunImpl() { parsed_args_ = Remove::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(parsed_args_.get()); @@ -458,14 +459,14 @@ bool RemoveCookieFunction::RunImpl() { // Pass the work off to the IO thread. bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&RemoveCookieFunction::RemoveCookieOnIOThread, this)); + base::Bind(&CookiesRemoveFunction::RemoveCookieOnIOThread, this)); DCHECK(rv); // Will return asynchronously. return true; } -void RemoveCookieFunction::RemoveCookieOnIOThread() { +void CookiesRemoveFunction::RemoveCookieOnIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Remove the cookie @@ -473,10 +474,10 @@ void RemoveCookieFunction::RemoveCookieOnIOThread() { store_context_->GetURLRequestContext()->cookie_store(); cookie_store->DeleteCookieAsync( url_, parsed_args_->details.name, - base::Bind(&RemoveCookieFunction::RemoveCookieCallback, this)); + base::Bind(&CookiesRemoveFunction::RemoveCookieCallback, this)); } -void RemoveCookieFunction::RemoveCookieCallback() { +void CookiesRemoveFunction::RemoveCookieCallback() { // Build the callback result Remove::Results::Details details; details.name = parsed_args_->details.name; @@ -487,16 +488,16 @@ void RemoveCookieFunction::RemoveCookieCallback() { // Return to UI thread bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&RemoveCookieFunction::RespondOnUIThread, this)); + base::Bind(&CookiesRemoveFunction::RespondOnUIThread, this)); DCHECK(rv); } -void RemoveCookieFunction::RespondOnUIThread() { +void CookiesRemoveFunction::RespondOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); SendResponse(true); } -bool GetAllCookieStoresFunction::RunImpl() { +bool CookiesGetAllCookieStoresFunction::RunImpl() { Profile* original_profile = profile(); DCHECK(original_profile); scoped_ptr<ListValue> original_tab_ids(new ListValue()); @@ -539,7 +540,7 @@ bool GetAllCookieStoresFunction::RunImpl() { return true; } -void GetAllCookieStoresFunction::Run() { +void CookiesGetAllCookieStoresFunction::Run() { SendResponse(RunImpl()); } diff --git a/chrome/browser/extensions/api/cookies/cookies_api.h b/chrome/browser/extensions/api/cookies/cookies_api.h index 5eddcd2..7c1b377 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.h +++ b/chrome/browser/extensions/api/cookies/cookies_api.h @@ -87,14 +87,14 @@ class CookiesFunction : public AsyncExtensionFunction { }; // Implements the cookies.get() extension function. -class GetCookieFunction : public CookiesFunction { +class CookiesGetFunction : public CookiesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cookies.get") - GetCookieFunction(); + CookiesGetFunction(); protected: - virtual ~GetCookieFunction(); + virtual ~CookiesGetFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -110,14 +110,14 @@ class GetCookieFunction : public CookiesFunction { }; // Implements the cookies.getAll() extension function. -class GetAllCookiesFunction : public CookiesFunction { +class CookiesGetAllFunction : public CookiesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAll") - GetAllCookiesFunction(); + CookiesGetAllFunction(); protected: - virtual ~GetAllCookiesFunction(); + virtual ~CookiesGetAllFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -133,14 +133,14 @@ class GetAllCookiesFunction : public CookiesFunction { }; // Implements the cookies.set() extension function. -class SetCookieFunction : public CookiesFunction { +class CookiesSetFunction : public CookiesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cookies.set") - SetCookieFunction(); + CookiesSetFunction(); protected: - virtual ~SetCookieFunction(); + virtual ~CookiesSetFunction(); virtual bool RunImpl() OVERRIDE; private: @@ -156,14 +156,14 @@ class SetCookieFunction : public CookiesFunction { }; // Implements the cookies.remove() extension function. -class RemoveCookieFunction : public CookiesFunction { +class CookiesRemoveFunction : public CookiesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cookies.remove") - RemoveCookieFunction(); + CookiesRemoveFunction(); protected: - virtual ~RemoveCookieFunction(); + virtual ~CookiesRemoveFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -179,15 +179,15 @@ class RemoveCookieFunction : public CookiesFunction { }; // Implements the cookies.getAllCookieStores() extension function. -class GetAllCookieStoresFunction : public CookiesFunction { +class CookiesGetAllCookieStoresFunction : public CookiesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("cookies.getAllCookieStores") protected: - virtual ~GetAllCookieStoresFunction() {} + virtual ~CookiesGetAllCookieStoresFunction() {} // ExtensionFunction: - // GetAllCookieStoresFunction is sync. + // CookiesGetAllCookieStoresFunction is sync. virtual void Run() OVERRIDE; virtual bool RunImpl() OVERRIDE; }; diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc index 79b28b7..d672af7 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.cc +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc @@ -104,7 +104,7 @@ class ExtensionDevToolsClientHost : public DevToolsClientHost, bool MatchesContentsAndExtensionId(WebContents* web_contents, const std::string& extension_id); void Close(); - void SendMessageToBackend(SendCommandDebuggerFunction* function, + void SendMessageToBackend(DebuggerSendCommandFunction* function, const std::string& method, SendCommand::Params::CommandParams* command_params); @@ -129,7 +129,7 @@ class ExtensionDevToolsClientHost : public DevToolsClientHost, int tab_id_; content::NotificationRegistrar registrar_; int last_request_id_; - typedef std::map<int, scoped_refptr<SendCommandDebuggerFunction> > + typedef std::map<int, scoped_refptr<DebuggerSendCommandFunction> > PendingRequests; PendingRequests pending_requests_; ExtensionDevToolsInfoBarDelegate* infobar_delegate_; @@ -249,7 +249,7 @@ void ExtensionDevToolsClientHost::Close() { } void ExtensionDevToolsClientHost::SendMessageToBackend( - SendCommandDebuggerFunction* function, + DebuggerSendCommandFunction* function, const std::string& method, SendCommand::Params::CommandParams* command_params) { DictionaryValue protocol_request; @@ -343,7 +343,7 @@ void ExtensionDevToolsClientHost::DispatchOnInspectorFrontend( extensions::ExtensionSystem::Get(profile)->event_router()-> DispatchEventToExtension(extension_id_, event.Pass()); } else { - SendCommandDebuggerFunction* function = pending_requests_[id]; + DebuggerSendCommandFunction* function = pending_requests_[id]; if (!function) return; @@ -457,11 +457,11 @@ bool DebuggerFunction::InitClientHost() { return true; } -AttachDebuggerFunction::AttachDebuggerFunction() {} +DebuggerAttachFunction::DebuggerAttachFunction() {} -AttachDebuggerFunction::~AttachDebuggerFunction() {} +DebuggerAttachFunction::~DebuggerAttachFunction() {} -bool AttachDebuggerFunction::RunImpl() { +bool DebuggerAttachFunction::RunImpl() { scoped_ptr<Attach::Params> params(Attach::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -497,11 +497,11 @@ bool AttachDebuggerFunction::RunImpl() { return true; } -DetachDebuggerFunction::DetachDebuggerFunction() {} +DebuggerDetachFunction::DebuggerDetachFunction() {} -DetachDebuggerFunction::~DetachDebuggerFunction() {} +DebuggerDetachFunction::~DebuggerDetachFunction() {} -bool DetachDebuggerFunction::RunImpl() { +bool DebuggerDetachFunction::RunImpl() { scoped_ptr<Detach::Params> params(Detach::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -514,11 +514,11 @@ bool DetachDebuggerFunction::RunImpl() { return true; } -SendCommandDebuggerFunction::SendCommandDebuggerFunction() {} +DebuggerSendCommandFunction::DebuggerSendCommandFunction() {} -SendCommandDebuggerFunction::~SendCommandDebuggerFunction() {} +DebuggerSendCommandFunction::~DebuggerSendCommandFunction() {} -bool SendCommandDebuggerFunction::RunImpl() { +bool DebuggerSendCommandFunction::RunImpl() { scoped_ptr<SendCommand::Params> params(SendCommand::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -531,7 +531,7 @@ bool SendCommandDebuggerFunction::RunImpl() { return true; } -void SendCommandDebuggerFunction::SendResponseBody( +void DebuggerSendCommandFunction::SendResponseBody( DictionaryValue* response) { Value* error_body; if (response->Get("error", &error_body)) { diff --git a/chrome/browser/extensions/api/debugger/debugger_api.h b/chrome/browser/extensions/api/debugger/debugger_api.h index 36b0cb5..44243d9 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.h +++ b/chrome/browser/extensions/api/debugger/debugger_api.h @@ -39,43 +39,43 @@ class DebuggerFunction : public AsyncExtensionFunction { }; // Implements the debugger.attach() extension function. -class AttachDebuggerFunction : public DebuggerFunction { +class DebuggerAttachFunction : public DebuggerFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("debugger.attach") - AttachDebuggerFunction(); + DebuggerAttachFunction(); protected: - virtual ~AttachDebuggerFunction(); + virtual ~DebuggerAttachFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // Implements the debugger.detach() extension function. -class DetachDebuggerFunction : public DebuggerFunction { +class DebuggerDetachFunction : public DebuggerFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("debugger.detach") - DetachDebuggerFunction(); + DebuggerDetachFunction(); protected: - virtual ~DetachDebuggerFunction(); + virtual ~DebuggerDetachFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // Implements the debugger.sendCommand() extension function. -class SendCommandDebuggerFunction : public DebuggerFunction { +class DebuggerSendCommandFunction : public DebuggerFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("debugger.sendCommand") - SendCommandDebuggerFunction(); + DebuggerSendCommandFunction(); void SendResponseBody(base::DictionaryValue* result); protected: - virtual ~SendCommandDebuggerFunction(); + virtual ~DebuggerSendCommandFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; diff --git a/chrome/browser/extensions/api/declarative/declarative_api.cc b/chrome/browser/extensions/api/declarative/declarative_api.cc index 57cd0e8..8c57352 100644 --- a/chrome/browser/extensions/api/declarative/declarative_api.cc +++ b/chrome/browser/extensions/api/declarative/declarative_api.cc @@ -61,7 +61,7 @@ bool RulesFunction::RunImpl() { return true; } -bool AddRulesFunction::RunImplOnCorrectThread() { +bool EventsAddRulesFunction::RunImplOnCorrectThread() { scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -73,7 +73,7 @@ bool AddRulesFunction::RunImplOnCorrectThread() { return error_.empty(); } -bool RemoveRulesFunction::RunImplOnCorrectThread() { +bool EventsRemoveRulesFunction::RunImplOnCorrectThread() { scoped_ptr<RemoveRules::Params> params(RemoveRules::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -87,7 +87,7 @@ bool RemoveRulesFunction::RunImplOnCorrectThread() { return error_.empty(); } -bool GetRulesFunction::RunImplOnCorrectThread() { +bool EventsGetRulesFunction::RunImplOnCorrectThread() { scoped_ptr<GetRules::Params> params(GetRules::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); diff --git a/chrome/browser/extensions/api/declarative/declarative_api.h b/chrome/browser/extensions/api/declarative/declarative_api.h index 5f7acc0..5caf4ac 100644 --- a/chrome/browser/extensions/api/declarative/declarative_api.h +++ b/chrome/browser/extensions/api/declarative/declarative_api.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ -#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ +#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H_ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" @@ -31,34 +31,34 @@ class RulesFunction : public AsyncExtensionFunction { scoped_refptr<RulesRegistry> rules_registry_; }; -class AddRulesFunction : public RulesFunction { +class EventsAddRulesFunction : public RulesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("events.addRules"); protected: - virtual ~AddRulesFunction() {} + virtual ~EventsAddRulesFunction() {} // RulesFunction: virtual bool RunImplOnCorrectThread() OVERRIDE; }; -class RemoveRulesFunction : public RulesFunction { +class EventsRemoveRulesFunction : public RulesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("events.removeRules"); protected: - virtual ~RemoveRulesFunction() {} + virtual ~EventsRemoveRulesFunction() {} // RulesFunction: virtual bool RunImplOnCorrectThread() OVERRIDE; }; -class GetRulesFunction : public RulesFunction { +class EventsGetRulesFunction : public RulesFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("events.getRules"); protected: - virtual ~GetRulesFunction() {} + virtual ~EventsGetRulesFunction() {} // RulesFunction: virtual bool RunImplOnCorrectThread() OVERRIDE; @@ -66,4 +66,4 @@ class GetRulesFunction : public RulesFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ +#endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H_ 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 802c625..7aeec6f 100644 --- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc @@ -217,7 +217,7 @@ FontSettingsAPI::FontSettingsAPI(Profile* profile) FontSettingsAPI::~FontSettingsAPI() { } -bool ClearFontFunction::RunImpl() { +bool FontSettingsClearFontFunction::RunImpl() { if (profile_->IsOffTheRecord()) { error_ = kSetFromIncognitoError; return false; @@ -242,7 +242,7 @@ bool ClearFontFunction::RunImpl() { return true; } -bool GetFontFunction::RunImpl() { +bool FontSettingsGetFontFunction::RunImpl() { scoped_ptr<fonts::GetFont::Params> params( fonts::GetFont::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -275,7 +275,7 @@ bool GetFontFunction::RunImpl() { return true; } -bool SetFontFunction::RunImpl() { +bool FontSettingsSetFontFunction::RunImpl() { if (profile_->IsOffTheRecord()) { error_ = kSetFromIncognitoError; return false; @@ -302,18 +302,19 @@ bool SetFontFunction::RunImpl() { return true; } -bool GetFontListFunction::RunImpl() { +bool FontSettingsGetFontListFunction::RunImpl() { content::GetFontListAsync( - Bind(&GetFontListFunction::FontListHasLoaded, this)); + Bind(&FontSettingsGetFontListFunction::FontListHasLoaded, this)); return true; } -void GetFontListFunction::FontListHasLoaded(scoped_ptr<ListValue> list) { +void FontSettingsGetFontListFunction::FontListHasLoaded( + scoped_ptr<ListValue> list) { bool success = CopyFontsToResult(list.get()); SendResponse(success); } -bool GetFontListFunction::CopyFontsToResult(ListValue* fonts) { +bool FontSettingsGetFontListFunction::CopyFontsToResult(ListValue* fonts) { scoped_ptr<ListValue> result(new ListValue()); for (ListValue::iterator it = fonts->begin(); it != fonts->end(); ++it) { ListValue* font_list_value; @@ -401,63 +402,63 @@ bool SetFontPrefExtensionFunction::RunImpl() { return true; } -const char* ClearDefaultFontSizeFunction::GetPrefName() { +const char* FontSettingsClearDefaultFontSizeFunction::GetPrefName() { return prefs::kWebKitDefaultFontSize; } -const char* GetDefaultFontSizeFunction::GetPrefName() { +const char* FontSettingsGetDefaultFontSizeFunction::GetPrefName() { return prefs::kWebKitDefaultFontSize; } -const char* GetDefaultFontSizeFunction::GetKey() { +const char* FontSettingsGetDefaultFontSizeFunction::GetKey() { return kPixelSizeKey; } -const char* SetDefaultFontSizeFunction::GetPrefName() { +const char* FontSettingsSetDefaultFontSizeFunction::GetPrefName() { return prefs::kWebKitDefaultFontSize; } -const char* SetDefaultFontSizeFunction::GetKey() { +const char* FontSettingsSetDefaultFontSizeFunction::GetKey() { return kPixelSizeKey; } -const char* ClearDefaultFixedFontSizeFunction::GetPrefName() { +const char* FontSettingsClearDefaultFixedFontSizeFunction::GetPrefName() { return prefs::kWebKitDefaultFixedFontSize; } -const char* GetDefaultFixedFontSizeFunction::GetPrefName() { +const char* FontSettingsGetDefaultFixedFontSizeFunction::GetPrefName() { return prefs::kWebKitDefaultFixedFontSize; } -const char* GetDefaultFixedFontSizeFunction::GetKey() { +const char* FontSettingsGetDefaultFixedFontSizeFunction::GetKey() { return kPixelSizeKey; } -const char* SetDefaultFixedFontSizeFunction::GetPrefName() { +const char* FontSettingsSetDefaultFixedFontSizeFunction::GetPrefName() { return prefs::kWebKitDefaultFixedFontSize; } -const char* SetDefaultFixedFontSizeFunction::GetKey() { +const char* FontSettingsSetDefaultFixedFontSizeFunction::GetKey() { return kPixelSizeKey; } -const char* ClearMinimumFontSizeFunction::GetPrefName() { +const char* FontSettingsClearMinimumFontSizeFunction::GetPrefName() { return prefs::kWebKitMinimumFontSize; } -const char* GetMinimumFontSizeFunction::GetPrefName() { +const char* FontSettingsGetMinimumFontSizeFunction::GetPrefName() { return prefs::kWebKitMinimumFontSize; } -const char* GetMinimumFontSizeFunction::GetKey() { +const char* FontSettingsGetMinimumFontSizeFunction::GetKey() { return kPixelSizeKey; } -const char* SetMinimumFontSizeFunction::GetPrefName() { +const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() { return prefs::kWebKitMinimumFontSize; } -const char* SetMinimumFontSizeFunction::GetKey() { +const char* FontSettingsSetMinimumFontSizeFunction::GetKey() { return kPixelSizeKey; } 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 e4d2cb0..3920ca8 100644 --- a/chrome/browser/extensions/api/font_settings/font_settings_api.h +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h @@ -5,8 +5,8 @@ // Defines the classes to realize the Font Settings Extension API as specified // in the extension API JSON. -#ifndef CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__ -#define CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__ +#ifndef CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_ #include <string> @@ -80,50 +80,50 @@ class FontSettingsAPI : public ProfileKeyedService { }; // fontSettings.clearFont API function. -class ClearFontFunction : public SyncExtensionFunction { +class FontSettingsClearFontFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearFont") protected: // RefCounted types have non-public destructors, as with all extension // functions in this file. - virtual ~ClearFontFunction() {} + virtual ~FontSettingsClearFontFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // fontSettings.getFont API function. -class GetFontFunction : public SyncExtensionFunction { +class FontSettingsGetFontFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getFont") protected: - virtual ~GetFontFunction() {} + virtual ~FontSettingsGetFontFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // fontSettings.setFont API function. -class SetFontFunction : public SyncExtensionFunction { +class FontSettingsSetFontFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setFont") protected: - virtual ~SetFontFunction() {} + virtual ~FontSettingsSetFontFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // fontSettings.getFontList API function. -class GetFontListFunction : public AsyncExtensionFunction { +class FontSettingsGetFontListFunction : public AsyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getFontList") protected: - virtual ~GetFontListFunction() {} + virtual ~FontSettingsGetFontListFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -183,106 +183,114 @@ class SetFontPrefExtensionFunction : public SyncExtensionFunction { // The following are get/set/clear API functions that act on a browser font // pref. -class ClearDefaultFontSizeFunction : public ClearFontPrefExtensionFunction { +class FontSettingsClearDefaultFontSizeFunction + : public ClearFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearDefaultFontSize") protected: - virtual ~ClearDefaultFontSizeFunction() {} + virtual ~FontSettingsClearDefaultFontSizeFunction() {} // ClearFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; }; -class GetDefaultFontSizeFunction : public GetFontPrefExtensionFunction { +class FontSettingsGetDefaultFontSizeFunction + : public GetFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getDefaultFontSize") protected: - virtual ~GetDefaultFontSizeFunction() {} + virtual ~FontSettingsGetDefaultFontSizeFunction() {} // GetFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; virtual const char* GetKey() OVERRIDE; }; -class SetDefaultFontSizeFunction : public SetFontPrefExtensionFunction { +class FontSettingsSetDefaultFontSizeFunction + : public SetFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setDefaultFontSize") protected: - virtual ~SetDefaultFontSizeFunction() {} + virtual ~FontSettingsSetDefaultFontSizeFunction() {} // SetFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; virtual const char* GetKey() OVERRIDE; }; -class ClearDefaultFixedFontSizeFunction +class FontSettingsClearDefaultFixedFontSizeFunction : public ClearFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearDefaultFixedFontSize") protected: - virtual ~ClearDefaultFixedFontSizeFunction() {} + virtual ~FontSettingsClearDefaultFixedFontSizeFunction() {} // ClearFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; }; -class GetDefaultFixedFontSizeFunction : public GetFontPrefExtensionFunction { +class FontSettingsGetDefaultFixedFontSizeFunction + : public GetFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getDefaultFixedFontSize") protected: - virtual ~GetDefaultFixedFontSizeFunction() {} + virtual ~FontSettingsGetDefaultFixedFontSizeFunction() {} // GetFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; virtual const char* GetKey() OVERRIDE; }; -class SetDefaultFixedFontSizeFunction : public SetFontPrefExtensionFunction { +class FontSettingsSetDefaultFixedFontSizeFunction + : public SetFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setDefaultFixedFontSize") protected: - virtual ~SetDefaultFixedFontSizeFunction() {} + virtual ~FontSettingsSetDefaultFixedFontSizeFunction() {} // SetFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; virtual const char* GetKey() OVERRIDE; }; -class ClearMinimumFontSizeFunction : public ClearFontPrefExtensionFunction { +class FontSettingsClearMinimumFontSizeFunction + : public ClearFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.clearMinimumFontSize") protected: - virtual ~ClearMinimumFontSizeFunction() {} + virtual ~FontSettingsClearMinimumFontSizeFunction() {} // ClearFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; }; -class GetMinimumFontSizeFunction : public GetFontPrefExtensionFunction { +class FontSettingsGetMinimumFontSizeFunction + : public GetFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.getMinimumFontSize") protected: - virtual ~GetMinimumFontSizeFunction() {} + virtual ~FontSettingsGetMinimumFontSizeFunction() {} // GetFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; virtual const char* GetKey() OVERRIDE; }; -class SetMinimumFontSizeFunction : public SetFontPrefExtensionFunction { +class FontSettingsSetMinimumFontSizeFunction + : public SetFontPrefExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fontSettings.setMinimumFontSize") protected: - virtual ~SetMinimumFontSizeFunction() {} + virtual ~FontSettingsSetMinimumFontSizeFunction() {} // SetFontPrefExtensionFunction: virtual const char* GetPrefName() OVERRIDE; @@ -291,4 +299,4 @@ class SetMinimumFontSizeFunction : public SetFontPrefExtensionFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__ +#endif // CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H_ diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc index 00af52c..06b5fcc 100644 --- a/chrome/browser/extensions/api/history/history_api.cc +++ b/chrome/browser/extensions/api/history/history_api.cc @@ -268,7 +268,7 @@ void HistoryFunctionWithCallback::SendResponseToCallback() { Release(); // Balanced in RunImpl(). } -bool GetMostVisitedHistoryFunction::RunAsyncImpl() { +bool HistoryGetMostVisitedFunction::RunAsyncImpl() { scoped_ptr<GetMostVisited::Params> params = GetMostVisited::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -288,12 +288,12 @@ bool GetMostVisitedHistoryFunction::RunAsyncImpl() { HistoryService* hs = HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS); hs->QueryFilteredURLs(max_results, filter, false, &cancelable_consumer_, - base::Bind(&GetMostVisitedHistoryFunction::QueryComplete, + base::Bind(&HistoryGetMostVisitedFunction::QueryComplete, base::Unretained(this))); return true; } -void GetMostVisitedHistoryFunction::QueryComplete( +void HistoryGetMostVisitedFunction::QueryComplete( CancelableRequestProvider::Handle handle, const history::FilteredURLList& data) { std::vector<linked_ptr<MostVisitedItem> > results; @@ -308,7 +308,7 @@ void GetMostVisitedHistoryFunction::QueryComplete( SendAsyncResponse(); } -bool GetVisitsHistoryFunction::RunAsyncImpl() { +bool HistoryGetVisitsFunction::RunAsyncImpl() { scoped_ptr<GetVisits::Params> params(GetVisits::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -322,13 +322,13 @@ bool GetVisitsHistoryFunction::RunAsyncImpl() { hs->QueryURL(url, true, // Retrieve full history of a URL. &cancelable_consumer_, - base::Bind(&GetVisitsHistoryFunction::QueryComplete, + base::Bind(&HistoryGetVisitsFunction::QueryComplete, base::Unretained(this))); return true; } -void GetVisitsHistoryFunction::QueryComplete( +void HistoryGetVisitsFunction::QueryComplete( HistoryService::Handle request_service, bool success, const history::URLRow* url_row, @@ -347,7 +347,7 @@ void GetVisitsHistoryFunction::QueryComplete( SendAsyncResponse(); } -bool SearchHistoryFunction::RunAsyncImpl() { +bool HistorySearchFunction::RunAsyncImpl() { scoped_ptr<Search::Params> params(Search::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -368,13 +368,13 @@ bool SearchHistoryFunction::RunAsyncImpl() { HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS); hs->QueryHistory(search_text, options, &cancelable_consumer_, - base::Bind(&SearchHistoryFunction::SearchComplete, + base::Bind(&HistorySearchFunction::SearchComplete, base::Unretained(this))); return true; } -void SearchHistoryFunction::SearchComplete( +void HistorySearchFunction::SearchComplete( HistoryService::Handle request_handle, history::QueryResults* results) { HistoryItemList history_item_vec; @@ -391,7 +391,7 @@ void SearchHistoryFunction::SearchComplete( SendAsyncResponse(); } -bool AddUrlHistoryFunction::RunImpl() { +bool HistoryAddUrlFunction::RunImpl() { scoped_ptr<AddUrl::Params> params(AddUrl::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -408,7 +408,7 @@ bool AddUrlHistoryFunction::RunImpl() { return true; } -bool DeleteUrlHistoryFunction::RunImpl() { +bool HistoryDeleteUrlFunction::RunImpl() { scoped_ptr<DeleteUrl::Params> params(DeleteUrl::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -425,7 +425,7 @@ bool DeleteUrlHistoryFunction::RunImpl() { return true; } -bool DeleteRangeHistoryFunction::RunAsyncImpl() { +bool HistoryDeleteRangeFunction::RunAsyncImpl() { scoped_ptr<DeleteRange::Params> params(DeleteRange::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -440,18 +440,18 @@ bool DeleteRangeHistoryFunction::RunAsyncImpl() { restrict_urls, start_time, end_time, - base::Bind(&DeleteRangeHistoryFunction::DeleteComplete, + base::Bind(&HistoryDeleteRangeFunction::DeleteComplete, base::Unretained(this)), &task_tracker_); return true; } -void DeleteRangeHistoryFunction::DeleteComplete() { +void HistoryDeleteRangeFunction::DeleteComplete() { SendAsyncResponse(); } -bool DeleteAllHistoryFunction::RunAsyncImpl() { +bool HistoryDeleteAllFunction::RunAsyncImpl() { std::set<GURL> restrict_urls; HistoryService* hs = HistoryServiceFactory::GetForProfile(profile(), @@ -460,14 +460,14 @@ bool DeleteAllHistoryFunction::RunAsyncImpl() { restrict_urls, base::Time::UnixEpoch(), // From the beginning of the epoch. base::Time::Now(), // To the current time. - base::Bind(&DeleteAllHistoryFunction::DeleteComplete, + base::Bind(&HistoryDeleteAllFunction::DeleteComplete, base::Unretained(this)), &task_tracker_); return true; } -void DeleteAllHistoryFunction::DeleteComplete() { +void HistoryDeleteAllFunction::DeleteComplete() { SendAsyncResponse(); } diff --git a/chrome/browser/extensions/api/history/history_api.h b/chrome/browser/extensions/api/history/history_api.h index 83860eb..9700b18 100644 --- a/chrome/browser/extensions/api/history/history_api.h +++ b/chrome/browser/extensions/api/history/history_api.h @@ -112,12 +112,12 @@ class HistoryFunctionWithCallback : public HistoryFunction { void SendResponseToCallback(); }; -class GetMostVisitedHistoryFunction : public HistoryFunctionWithCallback { +class HistoryGetMostVisitedFunction : public HistoryFunctionWithCallback { public: DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.getMostVisited"); protected: - virtual ~GetMostVisitedHistoryFunction() {} + virtual ~HistoryGetMostVisitedFunction() {} // HistoryFunctionWithCallback: virtual bool RunAsyncImpl() OVERRIDE; @@ -127,12 +127,12 @@ class GetMostVisitedHistoryFunction : public HistoryFunctionWithCallback { const history::FilteredURLList& data); }; -class GetVisitsHistoryFunction : public HistoryFunctionWithCallback { +class HistoryGetVisitsFunction : public HistoryFunctionWithCallback { public: DECLARE_EXTENSION_FUNCTION_NAME("history.getVisits"); protected: - virtual ~GetVisitsHistoryFunction() {} + virtual ~HistoryGetVisitsFunction() {} // HistoryFunctionWithCallback: virtual bool RunAsyncImpl() OVERRIDE; @@ -144,12 +144,12 @@ class GetVisitsHistoryFunction : public HistoryFunctionWithCallback { history::VisitVector* visits); }; -class SearchHistoryFunction : public HistoryFunctionWithCallback { +class HistorySearchFunction : public HistoryFunctionWithCallback { public: DECLARE_EXTENSION_FUNCTION_NAME("history.search"); protected: - virtual ~SearchHistoryFunction() {} + virtual ~HistorySearchFunction() {} // HistoryFunctionWithCallback: virtual bool RunAsyncImpl() OVERRIDE; @@ -159,23 +159,23 @@ class SearchHistoryFunction : public HistoryFunctionWithCallback { history::QueryResults* results); }; -class AddUrlHistoryFunction : public HistoryFunction { +class HistoryAddUrlFunction : public HistoryFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("history.addUrl"); protected: - virtual ~AddUrlHistoryFunction() {} + virtual ~HistoryAddUrlFunction() {} // HistoryFunctionWithCallback: virtual bool RunImpl() OVERRIDE; }; -class DeleteAllHistoryFunction : public HistoryFunctionWithCallback { +class HistoryDeleteAllFunction : public HistoryFunctionWithCallback { public: DECLARE_EXTENSION_FUNCTION_NAME("history.deleteAll"); protected: - virtual ~DeleteAllHistoryFunction() {} + virtual ~HistoryDeleteAllFunction() {} // HistoryFunctionWithCallback: virtual bool RunAsyncImpl() OVERRIDE; @@ -185,23 +185,23 @@ class DeleteAllHistoryFunction : public HistoryFunctionWithCallback { }; -class DeleteUrlHistoryFunction : public HistoryFunction { +class HistoryDeleteUrlFunction : public HistoryFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("history.deleteUrl"); protected: - virtual ~DeleteUrlHistoryFunction() {} + virtual ~HistoryDeleteUrlFunction() {} // HistoryFunctionWithCallback: virtual bool RunImpl() OVERRIDE; }; -class DeleteRangeHistoryFunction : public HistoryFunctionWithCallback { +class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback { public: DECLARE_EXTENSION_FUNCTION_NAME("history.deleteRange"); protected: - virtual ~DeleteRangeHistoryFunction() {} + virtual ~HistoryDeleteRangeFunction() {} // HistoryFunctionWithCallback: virtual bool RunAsyncImpl() OVERRIDE; diff --git a/chrome/browser/extensions/api/i18n/i18n_api.cc b/chrome/browser/extensions/api/i18n/i18n_api.cc index 51897da..ad2ef32 100644 --- a/chrome/browser/extensions/api/i18n/i18n_api.cc +++ b/chrome/browser/extensions/api/i18n/i18n_api.cc @@ -12,15 +12,15 @@ #include "base/string_split.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/pref_names.h" #include "chrome/common/extensions/api/i18n.h" +#include "chrome/common/pref_names.h" namespace GetAcceptLanguages = extensions::api::i18n::GetAcceptLanguages; // Errors. static const char kEmptyAcceptLanguagesError[] = "accept-languages is empty."; -bool GetAcceptLanguagesFunction::RunImpl() { +bool I18nGetAcceptLanguagesFunction::RunImpl() { std::string accept_languages = profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); // Currently, there are 2 ways to set browser's accept-languages: through UI diff --git a/chrome/browser/extensions/api/i18n/i18n_api.h b/chrome/browser/extensions/api/i18n/i18n_api.h index d69bd9b..1975f17 100644 --- a/chrome/browser/extensions/api/i18n/i18n_api.h +++ b/chrome/browser/extensions/api/i18n/i18n_api.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H__ -#define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H__ +#ifndef CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ #include "chrome/browser/extensions/extension_function.h" -class GetAcceptLanguagesFunction : public SyncExtensionFunction { - virtual ~GetAcceptLanguagesFunction() {} +class I18nGetAcceptLanguagesFunction : public SyncExtensionFunction { + virtual ~I18nGetAcceptLanguagesFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("i18n.getAcceptLanguages") }; -#endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H__ +#endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 140517a..04914f0 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -219,7 +219,7 @@ ExtensionService* AsyncManagementFunction::service() { return profile()->GetExtensionService(); } -bool GetAllExtensionsFunction::RunImpl() { +bool ManagementGetAllFunction::RunImpl() { ExtensionInfoList extensions; ExtensionSystem* system = ExtensionSystem::Get(profile()); @@ -231,7 +231,7 @@ bool GetAllExtensionsFunction::RunImpl() { return true; } -bool GetExtensionByIdFunction::RunImpl() { +bool ManagementGetFunction::RunImpl() { scoped_ptr<management::Get::Params> params( management::Get::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -250,7 +250,7 @@ bool GetExtensionByIdFunction::RunImpl() { return true; } -bool GetPermissionWarningsByIdFunction::RunImpl() { +bool ManagementGetPermissionWarningsByIdFunction::RunImpl() { scoped_ptr<management::GetPermissionWarningsById::Params> params( management::GetPermissionWarningsById::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -269,12 +269,13 @@ bool GetPermissionWarningsByIdFunction::RunImpl() { namespace { -// This class helps GetPermissionWarningsByManifestFunction manage +// This class helps ManagementGetPermissionWarningsByManifestFunction manage // sending manifest JSON strings to the utility process for parsing. class SafeManifestJSONParser : public UtilityProcessHostClient { public: - SafeManifestJSONParser(GetPermissionWarningsByManifestFunction* client, - const std::string& manifest) + SafeManifestJSONParser( + ManagementGetPermissionWarningsByManifestFunction* client, + const std::string& manifest) : client_(client), manifest_(manifest) {} @@ -345,7 +346,7 @@ class SafeManifestJSONParser : public UtilityProcessHostClient { ~SafeManifestJSONParser() {} // The client who we'll report results back to. - GetPermissionWarningsByManifestFunction* client_; + ManagementGetPermissionWarningsByManifestFunction* client_; // Data to parse. std::string manifest_; @@ -358,7 +359,7 @@ class SafeManifestJSONParser : public UtilityProcessHostClient { } // namespace -bool GetPermissionWarningsByManifestFunction::RunImpl() { +bool ManagementGetPermissionWarningsByManifestFunction::RunImpl() { scoped_ptr<management::GetPermissionWarningsByManifest::Params> params( management::GetPermissionWarningsByManifest::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -374,7 +375,7 @@ bool GetPermissionWarningsByManifestFunction::RunImpl() { return true; } -void GetPermissionWarningsByManifestFunction::OnParseSuccess( +void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess( DictionaryValue* parsed_manifest) { CHECK(parsed_manifest); @@ -395,7 +396,7 @@ void GetPermissionWarningsByManifestFunction::OnParseSuccess( Release(); } -void GetPermissionWarningsByManifestFunction::OnParseFailure( +void ManagementGetPermissionWarningsByManifestFunction::OnParseFailure( const std::string& error) { error_ = error; SendResponse(false); @@ -404,7 +405,7 @@ void GetPermissionWarningsByManifestFunction::OnParseFailure( Release(); } -bool LaunchAppFunction::RunImpl() { +bool ManagementLaunchAppFunction::RunImpl() { scoped_ptr<management::LaunchApp::Params> params( management::LaunchApp::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -436,13 +437,13 @@ bool LaunchAppFunction::RunImpl() { return true; } -SetEnabledFunction::SetEnabledFunction() { +ManagementSetEnabledFunction::ManagementSetEnabledFunction() { } -SetEnabledFunction::~SetEnabledFunction() { +ManagementSetEnabledFunction::~ManagementSetEnabledFunction() { } -bool SetEnabledFunction::RunImpl() { +bool ManagementSetEnabledFunction::RunImpl() { scoped_ptr<management::SetEnabled::Params> params( management::SetEnabled::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -487,30 +488,30 @@ bool SetEnabledFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&SetEnabledFunction::SendResponse, this, true)); + base::Bind(&ManagementSetEnabledFunction::SendResponse, this, true)); return true; } -void SetEnabledFunction::InstallUIProceed() { +void ManagementSetEnabledFunction::InstallUIProceed() { service()->EnableExtension(extension_id_); SendResponse(true); Release(); } -void SetEnabledFunction::InstallUIAbort(bool user_initiated) { +void ManagementSetEnabledFunction::InstallUIAbort(bool user_initiated) { error_ = keys::kUserDidNotReEnableError; SendResponse(false); Release(); } -UninstallFunction::UninstallFunction() { +ManagementUninstallFunction::ManagementUninstallFunction() { } -UninstallFunction::~UninstallFunction() { +ManagementUninstallFunction::~ManagementUninstallFunction() { } -bool UninstallFunction::RunImpl() { +bool ManagementUninstallFunction::RunImpl() { scoped_ptr<management::Uninstall::Params> params( management::Uninstall::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -552,11 +553,11 @@ bool UninstallFunction::RunImpl() { } // static -void UninstallFunction::SetAutoConfirmForTest(bool should_proceed) { +void ManagementUninstallFunction::SetAutoConfirmForTest(bool should_proceed) { auto_confirm_for_test = should_proceed ? PROCEED : ABORT; } -void UninstallFunction::Finish(bool should_uninstall) { +void ManagementUninstallFunction::Finish(bool should_uninstall) { if (should_uninstall) { bool success = service()->UninstallExtension( extension_id_, @@ -573,12 +574,12 @@ void UninstallFunction::Finish(bool should_uninstall) { } -void UninstallFunction::ExtensionUninstallAccepted() { +void ManagementUninstallFunction::ExtensionUninstallAccepted() { Finish(true); Release(); } -void UninstallFunction::ExtensionUninstallCanceled() { +void ManagementUninstallFunction::ExtensionUninstallCanceled() { Finish(false); Release(); } diff --git a/chrome/browser/extensions/api/management/management_api.h b/chrome/browser/extensions/api/management/management_api.h index 1bb39ee..07553c8 100644 --- a/chrome/browser/extensions/api/management/management_api.h +++ b/chrome/browser/extensions/api/management/management_api.h @@ -34,40 +34,41 @@ class AsyncManagementFunction : public AsyncExtensionFunction { ExtensionService* service(); }; -class GetAllExtensionsFunction : public ManagementFunction { +class ManagementGetAllFunction : public ManagementFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("management.getAll"); protected: - virtual ~GetAllExtensionsFunction() {} + virtual ~ManagementGetAllFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetExtensionByIdFunction : public ManagementFunction { +class ManagementGetFunction : public ManagementFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("management.get"); protected: - virtual ~GetExtensionByIdFunction() {} + virtual ~ManagementGetFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetPermissionWarningsByIdFunction : public ManagementFunction { +class ManagementGetPermissionWarningsByIdFunction : public ManagementFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("management.getPermissionWarningsById"); protected: - virtual ~GetPermissionWarningsByIdFunction() {} + virtual ~ManagementGetPermissionWarningsByIdFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class GetPermissionWarningsByManifestFunction : public AsyncExtensionFunction { +class ManagementGetPermissionWarningsByManifestFunction + : public AsyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME( "management.getPermissionWarningsByManifest"); @@ -77,32 +78,32 @@ class GetPermissionWarningsByManifestFunction : public AsyncExtensionFunction { void OnParseFailure(const std::string& error); protected: - virtual ~GetPermissionWarningsByManifestFunction() {} + virtual ~ManagementGetPermissionWarningsByManifestFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class LaunchAppFunction : public ManagementFunction { +class ManagementLaunchAppFunction : public ManagementFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("management.launchApp"); protected: - virtual ~LaunchAppFunction() {} + virtual ~ManagementLaunchAppFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; -class SetEnabledFunction : public AsyncManagementFunction, +class ManagementSetEnabledFunction : public AsyncManagementFunction, public ExtensionInstallPrompt::Delegate { public: DECLARE_EXTENSION_FUNCTION_NAME("management.setEnabled"); - SetEnabledFunction(); + ManagementSetEnabledFunction(); protected: - virtual ~SetEnabledFunction(); + virtual ~ManagementSetEnabledFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; @@ -118,12 +119,12 @@ class SetEnabledFunction : public AsyncManagementFunction, scoped_ptr<ExtensionInstallPrompt> install_prompt_; }; -class UninstallFunction : public AsyncManagementFunction, +class ManagementUninstallFunction : public AsyncManagementFunction, public ExtensionUninstallDialog::Delegate { public: DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); - UninstallFunction(); + ManagementUninstallFunction(); static void SetAutoConfirmForTest(bool should_proceed); // ExtensionUninstallDialog::Delegate implementation. @@ -131,7 +132,7 @@ class UninstallFunction : public AsyncManagementFunction, virtual void ExtensionUninstallCanceled() OVERRIDE; private: - virtual ~UninstallFunction(); + virtual ~ManagementUninstallFunction(); virtual bool RunImpl() OVERRIDE; diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index 5ca8f4c6..3250a3b 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc @@ -106,8 +106,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, const std::string id = extension->id(); // Uninstall, then cancel via the confirm dialog. - scoped_refptr<UninstallFunction> uninstall_function(new UninstallFunction()); - UninstallFunction::SetAutoConfirmForTest(false); + scoped_refptr<ManagementUninstallFunction> uninstall_function( + new ManagementUninstallFunction()); + ManagementUninstallFunction::SetAutoConfirmForTest(false); EXPECT_TRUE(MatchPattern( util::RunFunctionAndReturnError( @@ -121,8 +122,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, EXPECT_TRUE(service->GetExtensionById(id, false) != NULL); // Uninstall, then accept via the confirm dialog. - uninstall_function = new UninstallFunction(); - UninstallFunction::SetAutoConfirmForTest(true); + uninstall_function = new ManagementUninstallFunction(); + ManagementUninstallFunction::SetAutoConfirmForTest(true); util::RunFunctionAndReturnSingleResult( uninstall_function, @@ -144,8 +145,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, ASSERT_TRUE(listener.WaitUntilSatisfied()); // The management API should list this extension. - scoped_refptr<GetAllExtensionsFunction> function = - new GetAllExtensionsFunction(); + scoped_refptr<ManagementGetAllFunction> function = + new ManagementGetAllFunction(); scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( function.get(), "[]", browser())); base::ListValue* list; @@ -155,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, // And it should continue to do so even after it crashes. ASSERT_TRUE(CrashEnabledExtension(extension->id())); - function = new GetAllExtensionsFunction(); + function = new ManagementGetAllFunction(); result.reset(util::RunFunctionAndReturnSingleResult( function.get(), "[]", browser())); ASSERT_TRUE(result->GetAsList(&list)); @@ -200,7 +201,8 @@ class ExtensionManagementApiEscalationTest : void SetEnabled(bool enabled, bool user_gesture, const std::string& expected_error) { - scoped_refptr<SetEnabledFunction> function(new SetEnabledFunction); + scoped_refptr<ManagementSetEnabledFunction> function( + new ManagementSetEnabledFunction); const char* enabled_string = enabled ? "true" : "false"; if (user_gesture) function->set_user_gesture(true); @@ -227,8 +229,8 @@ const char ExtensionManagementApiEscalationTest::kId[] = IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, DisabledReason) { - scoped_refptr<GetExtensionByIdFunction> function = - new GetExtensionByIdFunction(); + scoped_refptr<ManagementGetFunction> function = + new ManagementGetFunction(); scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( function.get(), base::StringPrintf("[\"%s\"]", kId), diff --git a/chrome/browser/extensions/api/permissions/permissions_api.cc b/chrome/browser/extensions/api/permissions/permissions_api.cc index c395b9d..ba71c9c 100644 --- a/chrome/browser/extensions/api/permissions/permissions_api.cc +++ b/chrome/browser/extensions/api/permissions/permissions_api.cc @@ -52,7 +52,7 @@ bool ignore_user_gesture_for_tests = false; } // namespace -bool ContainsPermissionsFunction::RunImpl() { +bool PermissionsContainsFunction::RunImpl() { scoped_ptr<Contains::Params> params(Contains::Params::Create(*args_)); scoped_refptr<PermissionSet> permissions = @@ -65,14 +65,14 @@ bool ContainsPermissionsFunction::RunImpl() { return true; } -bool GetAllPermissionsFunction::RunImpl() { +bool PermissionsGetAllFunction::RunImpl() { scoped_ptr<Permissions> permissions = helpers::PackPermissionSet(GetExtension()->GetActivePermissions()); results_ = GetAll::Results::Create(*permissions); return true; } -bool RemovePermissionsFunction::RunImpl() { +bool PermissionsRemoveFunction::RunImpl() { scoped_ptr<Remove::Params> params(Remove::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -110,19 +110,19 @@ bool RemovePermissionsFunction::RunImpl() { } // static -void RequestPermissionsFunction::SetAutoConfirmForTests(bool should_proceed) { +void PermissionsRequestFunction::SetAutoConfirmForTests(bool should_proceed) { auto_confirm_for_tests = should_proceed ? PROCEED : ABORT; } // static -void RequestPermissionsFunction::SetIgnoreUserGestureForTests( +void PermissionsRequestFunction::SetIgnoreUserGestureForTests( bool ignore) { ignore_user_gesture_for_tests = ignore; } -RequestPermissionsFunction::RequestPermissionsFunction() {} +PermissionsRequestFunction::PermissionsRequestFunction() {} -void RequestPermissionsFunction::InstallUIProceed() { +void PermissionsRequestFunction::InstallUIProceed() { PermissionsUpdater perms_updater(profile()); perms_updater.AddPermissions(GetExtension(), requested_permissions_.get()); @@ -132,16 +132,16 @@ void RequestPermissionsFunction::InstallUIProceed() { Release(); // Balanced in RunImpl(). } -void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) { +void PermissionsRequestFunction::InstallUIAbort(bool user_initiated) { results_ = Request::Results::Create(false); SendResponse(true); Release(); // Balanced in RunImpl(). } -RequestPermissionsFunction::~RequestPermissionsFunction() {} +PermissionsRequestFunction::~PermissionsRequestFunction() {} -bool RequestPermissionsFunction::RunImpl() { +bool PermissionsRequestFunction::RunImpl() { if (!user_gesture() && !ignore_user_gesture_for_tests) { error_ = kUserGestureRequiredError; return false; diff --git a/chrome/browser/extensions/api/permissions/permissions_api.h b/chrome/browser/extensions/api/permissions/permissions_api.h index 9801ea1..21281e2 100644 --- a/chrome/browser/extensions/api/permissions/permissions_api.h +++ b/chrome/browser/extensions/api/permissions/permissions_api.h @@ -15,48 +15,48 @@ class ExtensionService; // chrome.permissions.contains -class ContainsPermissionsFunction : public SyncExtensionFunction { +class PermissionsContainsFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("permissions.contains") protected: - virtual ~ContainsPermissionsFunction() {} + virtual ~PermissionsContainsFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // chrome.permissions.getAll -class GetAllPermissionsFunction : public SyncExtensionFunction { +class PermissionsGetAllFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("permissions.getAll") protected: - virtual ~GetAllPermissionsFunction() {} + virtual ~PermissionsGetAllFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // chrome.permissions.remove -class RemovePermissionsFunction : public SyncExtensionFunction { +class PermissionsRemoveFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("permissions.remove") protected: - virtual ~RemovePermissionsFunction() {} + virtual ~PermissionsRemoveFunction() {} // ExtensionFunction: virtual bool RunImpl() OVERRIDE; }; // chrome.permissions.request -class RequestPermissionsFunction : public AsyncExtensionFunction, +class PermissionsRequestFunction : public AsyncExtensionFunction, public ExtensionInstallPrompt::Delegate { public: DECLARE_EXTENSION_FUNCTION_NAME("permissions.request") - RequestPermissionsFunction(); + PermissionsRequestFunction(); // FOR TESTS ONLY to bypass the confirmation UI. static void SetAutoConfirmForTests(bool should_proceed); @@ -67,7 +67,7 @@ class RequestPermissionsFunction : public AsyncExtensionFunction, virtual void InstallUIAbort(bool user_initiated) OVERRIDE; protected: - virtual ~RequestPermissionsFunction(); + virtual ~PermissionsRequestFunction(); // ExtensionFunction: virtual bool RunImpl() OVERRIDE; diff --git a/chrome/browser/extensions/api/permissions/permissions_apitest.cc b/chrome/browser/extensions/api/permissions/permissions_apitest.cc index 4006d9b..a3944b5 100644 --- a/chrome/browser/extensions/api/permissions/permissions_apitest.cc +++ b/chrome/browser/extensions/api/permissions/permissions_apitest.cc @@ -85,7 +85,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGranted) { prefs->AddGrantedPermissions("kjmkgkdkpedkejedfhmfcenooemhbpbo", granted_permissions); - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); ASSERT_TRUE(StartTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional")) << message_; @@ -95,8 +95,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGranted) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsAutoConfirm) { // Rather than setting the granted permissions, set the UI autoconfirm flag // and run the same tests. - RequestPermissionsFunction::SetAutoConfirmForTests(true); - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetAutoConfirmForTests(true); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); ASSERT_TRUE(StartTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional")) << message_; @@ -107,15 +107,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsAutoConfirm) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ComplexOptionalPermissions) { // Rather than setting the granted permissions, set the UI autoconfirm flag // and run the same tests. - RequestPermissionsFunction::SetAutoConfirmForTests(true); - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetAutoConfirmForTests(true); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); EXPECT_TRUE(RunExtensionTest("permissions/complex_optional")) << message_; } // Test that denying the optional permissions confirmation dialog works. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsDeny) { - RequestPermissionsFunction::SetAutoConfirmForTests(false); - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetAutoConfirmForTests(false); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); ASSERT_TRUE(StartTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional_deny")) << message_; @@ -124,7 +124,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsDeny) { // Tests that the permissions.request function must be called from within a // user gesture. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OptionalPermissionsGesture) { - RequestPermissionsFunction::SetIgnoreUserGestureForTests(false); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(false); host_resolver()->AddRule("*.com", "127.0.0.1"); ASSERT_TRUE(StartTestServer()); EXPECT_TRUE(RunExtensionTest("permissions/optional_gesture")) << message_; diff --git a/chrome/browser/extensions/api/processes/processes_api.cc b/chrome/browser/extensions/api/processes/processes_api.cc index 3042051..eb20dac 100644 --- a/chrome/browser/extensions/api/processes/processes_api.cc +++ b/chrome/browser/extensions/api/processes/processes_api.cc @@ -12,7 +12,6 @@ #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" - #include "chrome/browser/extensions/api/processes/processes_api_constants.h" #include "chrome/browser/extensions/api/tabs/tabs_constants.h" #include "chrome/browser/extensions/event_router.h" diff --git a/chrome/browser/extensions/api/record/record_api.cc b/chrome/browser/extensions/api/record/record_api.cc index ff60cb3..a16b755 100644 --- a/chrome/browser/extensions/api/record/record_api.cc +++ b/chrome/browser/extensions/api/record/record_api.cc @@ -152,16 +152,16 @@ const ProcessStrategy &RunPageCyclerFunction::GetProcessStrategy() { return *process_strategy_; } -// CaptureURLsFunction ------------------------------------------------ +// RecordCaptureURLsFunction ------------------------------------------------ -CaptureURLsFunction::CaptureURLsFunction() +RecordCaptureURLsFunction::RecordCaptureURLsFunction() : RunPageCyclerFunction(new ProductionProcessStrategy()) {} -CaptureURLsFunction::CaptureURLsFunction(ProcessStrategy* strategy) +RecordCaptureURLsFunction::RecordCaptureURLsFunction(ProcessStrategy* strategy) : RunPageCyclerFunction(strategy) {} // Fetch data for possible optional switch for an extension to load. -bool CaptureURLsFunction::ParseJSParameters() { +bool RecordCaptureURLsFunction::ParseJSParameters() { scoped_ptr<record::CaptureURLs::Params> params( record::CaptureURLs::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -174,34 +174,34 @@ bool CaptureURLsFunction::ParseJSParameters() { return true; } -// CaptureURLsFunction adds "record-mode" to sub-browser call, and returns +// RecordCaptureURLsFunction adds "record-mode" to sub-browser call, and returns // just the (possibly empty) error list. -void CaptureURLsFunction::AddSwitches(CommandLine* line) { +void RecordCaptureURLsFunction::AddSwitches(CommandLine* line) { if (!line->HasSwitch(switches::kRecordMode)) line->AppendSwitch(switches::kRecordMode); } -void CaptureURLsFunction::Finish() { +void RecordCaptureURLsFunction::Finish() { results_ = record::CaptureURLs::Results::Create(errors_); SendResponse(true); } -// ReplayURLsFunction ------------------------------------------------ +// RecordReplayURLsFunction ------------------------------------------------ -ReplayURLsFunction::ReplayURLsFunction() +RecordReplayURLsFunction::RecordReplayURLsFunction() : RunPageCyclerFunction(new ProductionProcessStrategy()), run_time_ms_(0.0) { } -ReplayURLsFunction::ReplayURLsFunction(ProcessStrategy* strategy) +RecordReplayURLsFunction::RecordReplayURLsFunction(ProcessStrategy* strategy) : RunPageCyclerFunction(strategy), run_time_ms_(0.0) { } -ReplayURLsFunction::~ReplayURLsFunction() {} +RecordReplayURLsFunction::~RecordReplayURLsFunction() {} // Fetch data for possible optional switches for a repeat count and an // extension to load. -bool ReplayURLsFunction::ParseJSParameters() { +bool RecordReplayURLsFunction::ParseJSParameters() { scoped_ptr<record::ReplayURLs::Params> params( record::ReplayURLs::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -228,7 +228,7 @@ bool ReplayURLsFunction::ParseJSParameters() { // plus temp file into which to place stats. (Can't do this in // ParseJSParameters because file creation can't go on the UI thread.) // Plus, initialize time to create run time statistic. -void ReplayURLsFunction::AddSwitches(CommandLine* line) { +void RecordReplayURLsFunction::AddSwitches(CommandLine* line) { file_util::CreateTemporaryFile(&stats_file_path_); if (!extension_path_.empty()) @@ -240,13 +240,13 @@ void ReplayURLsFunction::AddSwitches(CommandLine* line) { } // Read stats file, and get run time. -void ReplayURLsFunction::ReadReplyFiles() { +void RecordReplayURLsFunction::ReadReplyFiles() { file_util::ReadFileToString(stats_file_path_, &stats_); run_time_ms_ = (base::Time::NowFromSystemTime() - timer_).InMillisecondsF(); } -void ReplayURLsFunction::Finish() { +void RecordReplayURLsFunction::Finish() { record::ReplayURLsResult result; result.run_time = run_time_ms_; diff --git a/chrome/browser/extensions/api/record/record_api.h b/chrome/browser/extensions/api/record/record_api.h index 4f5559a..69974ac 100644 --- a/chrome/browser/extensions/api/record/record_api.h +++ b/chrome/browser/extensions/api/record/record_api.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_RECORD_RECORD_API_H_ -#include "chrome/browser/extensions/extension_function.h" #include "base/command_line.h" #include "base/file_path.h" #include "base/time.h" +#include "chrome/browser/extensions/extension_function.h" namespace { @@ -105,15 +105,15 @@ class RunPageCyclerFunction : public AsyncExtensionFunction { scoped_ptr<ProcessStrategy> process_strategy_; }; -class CaptureURLsFunction : public RunPageCyclerFunction { +class RecordCaptureURLsFunction : public RunPageCyclerFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("experimental.record.captureURLs"); - CaptureURLsFunction(); - explicit CaptureURLsFunction(ProcessStrategy* strategy); + RecordCaptureURLsFunction(); + explicit RecordCaptureURLsFunction(ProcessStrategy* strategy); private: - virtual ~CaptureURLsFunction() {} + virtual ~RecordCaptureURLsFunction() {} // Read the ReplayDetails parameter if it exists. virtual bool ParseJSParameters() OVERRIDE; @@ -125,15 +125,15 @@ class CaptureURLsFunction : public RunPageCyclerFunction { virtual void Finish() OVERRIDE; }; -class ReplayURLsFunction : public RunPageCyclerFunction { +class RecordReplayURLsFunction : public RunPageCyclerFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("experimental.record.replayURLs"); - ReplayURLsFunction(); - explicit ReplayURLsFunction(ProcessStrategy* strategy); + RecordReplayURLsFunction(); + explicit RecordReplayURLsFunction(ProcessStrategy* strategy); private: - virtual ~ReplayURLsFunction(); + virtual ~RecordReplayURLsFunction(); // Read the ReplayDetails parameter if it exists. virtual bool ParseJSParameters() OVERRIDE; diff --git a/chrome/browser/extensions/api/record/record_api_test.cc b/chrome/browser/extensions/api/record/record_api_test.cc index c81dbe1..50de96a 100644 --- a/chrome/browser/extensions/api/record/record_api_test.cc +++ b/chrome/browser/extensions/api/record/record_api_test.cc @@ -217,13 +217,14 @@ class RecordApiTest : public InProcessBrowserTest { // Run a capture, using standard URL test list and the specified // user data dir. Return via |out_list| the list of error URLs, // if any, resulting from the capture. And return directly the - // CaptureURLsFunction that was used, so that its state may be + // RecordCaptureURLsFunction that was used, so that its state may be // queried. - scoped_refptr<CaptureURLsFunction> RunCapture(const FilePath& user_data_dir, + scoped_refptr<RecordCaptureURLsFunction> RunCapture( + const FilePath& user_data_dir, scoped_ptr<base::ListValue>* out_list) { - scoped_refptr<CaptureURLsFunction> capture_function( - new CaptureURLsFunction(new TestProcessStrategy(&temp_files_))); + scoped_refptr<RecordCaptureURLsFunction> capture_function( + new RecordCaptureURLsFunction(new TestProcessStrategy(&temp_files_))); std::string escaped_user_data_dir; ReplaceChars(user_data_dir.AsUTF8Unsafe(), "\\", "\\\\", @@ -277,7 +278,7 @@ IN_PROC_BROWSER_TEST_F(RecordApiTest, DISABLED_CheckCapture) { scoped_ptr<base::ListValue> result; EXPECT_TRUE(user_data_dir.CreateUniqueTempDir()); - scoped_refptr<CaptureURLsFunction> capture_URLs_function = + scoped_refptr<RecordCaptureURLsFunction> capture_URLs_function = RunCapture(user_data_dir.path(), &result); // Check that user-data-dir switch has been properly overridden. @@ -314,7 +315,8 @@ IN_PROC_BROWSER_TEST_F(RecordApiTest, MAYBE_CheckPlayback) { ReplaceChars(user_data_dir.path().AsUTF8Unsafe(), "\\", "\\\\", &escaped_user_data_dir); - scoped_refptr<ReplayURLsFunction> playback_function(new ReplayURLsFunction( + scoped_refptr<RecordReplayURLsFunction> playback_function( + new RecordReplayURLsFunction( new TestProcessStrategy(&temp_files_))); scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult(playback_function, diff --git a/chrome/browser/extensions/settings/leveldb_settings_storage_factory.cc b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc index d057529..6fbffbf 100644 --- a/chrome/browser/extensions/settings/leveldb_settings_storage_factory.cc +++ b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h" #include "base/logging.h" #include "chrome/browser/value_store/leveldb_value_store.h" diff --git a/chrome/browser/extensions/settings/leveldb_settings_storage_factory.h b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h index 8a88f0d..395fcfc 100644 --- a/chrome/browser/extensions/settings/leveldb_settings_storage_factory.h +++ b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_LEVELDB_SETTINGS_STORAGE_FACTORY_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_LEVELDB_SETTINGS_STORAGE_FACTORY_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_LEVELDB_SETTINGS_STORAGE_FACTORY_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_LEVELDB_SETTINGS_STORAGE_FACTORY_H_ -#include "chrome/browser/extensions/settings/settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_storage_factory.h" namespace extensions { @@ -22,4 +22,4 @@ class LeveldbSettingsStorageFactory : public SettingsStorageFactory { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_LEVELDB_SETTINGS_STORAGE_FACTORY_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_LEVELDB_SETTINGS_STORAGE_FACTORY_H_ diff --git a/chrome/browser/extensions/settings/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc index 62eb094..e71d9bf 100644 --- a/chrome/browser/extensions/settings/managed_value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/managed_value_store_cache.h" +#include "chrome/browser/extensions/api/storage/managed_value_store_cache.h" #include <set> @@ -12,10 +12,10 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/message_loop_proxy.h" +#include "chrome/browser/extensions/api/storage/policy_value_store.h" +#include "chrome/browser/extensions/api/storage/settings_storage_factory.h" #include "chrome/browser/extensions/event_names.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/settings/policy_value_store.h" -#include "chrome/browser/extensions/settings/settings_storage_factory.h" #include "chrome/browser/value_store/value_store_change.h" #include "chrome/common/extensions/extension.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/extensions/settings/managed_value_store_cache.h b/chrome/browser/extensions/api/storage/managed_value_store_cache.h index 9a1ea7b..2862732 100644 --- a/chrome/browser/extensions/settings/managed_value_store_cache.h +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ #include <map> #include <string> @@ -16,9 +16,9 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" +#include "chrome/browser/extensions/api/storage/value_store_cache.h" #include "chrome/browser/extensions/event_router.h" -#include "chrome/browser/extensions/settings/settings_observer.h" -#include "chrome/browser/extensions/settings/value_store_cache.h" #include "chrome/browser/policy/policy_service.h" namespace policy { @@ -151,4 +151,4 @@ class ManagedValueStoreCache : public ValueStoreCache, } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ diff --git a/chrome/browser/extensions/settings/policy_value_store.cc b/chrome/browser/extensions/api/storage/policy_value_store.cc index 88e2de8..8e84994 100644 --- a/chrome/browser/extensions/settings/policy_value_store.cc +++ b/chrome/browser/extensions/api/storage/policy_value_store.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/policy_value_store.h" +#include "chrome/browser/extensions/api/storage/policy_value_store.h" #include "base/logging.h" #include "base/values.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/policy_types.h" #include "chrome/browser/value_store/value_store_change.h" diff --git a/chrome/browser/extensions/settings/policy_value_store.h b/chrome/browser/extensions/api/storage/policy_value_store.h index adf5129..ea4f4da 100644 --- a/chrome/browser/extensions/settings/policy_value_store.h +++ b/chrome/browser/extensions/api/storage/policy_value_store.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_POLICY_VALUE_STORE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_POLICY_VALUE_STORE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_ #include <string> #include <vector> @@ -11,7 +11,7 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/settings/settings_observer.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" #include "chrome/browser/value_store/value_store.h" namespace policy { @@ -72,4 +72,4 @@ class PolicyValueStore : public ValueStore { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_POLICY_VALUE_STORE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_ diff --git a/chrome/browser/extensions/settings/policy_value_store_unittest.cc b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc index 0d7fa45..06f1ad9 100644 --- a/chrome/browser/extensions/settings/policy_value_store_unittest.cc +++ b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/policy_value_store.h" +#include "chrome/browser/extensions/api/storage/policy_value_store.h" #include "base/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" -#include "chrome/browser/extensions/settings/settings_observer.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/value_store/leveldb_value_store.h" #include "chrome/browser/value_store/value_store_unittest.h" diff --git a/chrome/browser/extensions/settings/setting_sync_data.cc b/chrome/browser/extensions/api/storage/setting_sync_data.cc index 4baf04c..cb4fe79 100644 --- a/chrome/browser/extensions/settings/setting_sync_data.cc +++ b/chrome/browser/extensions/api/storage/setting_sync_data.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/setting_sync_data.h" +#include "chrome/browser/extensions/api/storage/setting_sync_data.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" diff --git a/chrome/browser/extensions/settings/setting_sync_data.h b/chrome/browser/extensions/api/storage/setting_sync_data.h index fc9d1d4..4cecb23 100644 --- a/chrome/browser/extensions/settings/setting_sync_data.h +++ b/chrome/browser/extensions/api/storage/setting_sync_data.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -88,4 +88,4 @@ typedef std::vector<SettingSyncData> SettingSyncDataList; } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTING_SYNC_DATA_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ diff --git a/chrome/browser/extensions/settings/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc index 26fa606..71df9d4 100644 --- a/chrome/browser/extensions/settings/settings_apitest.cc +++ b/chrome/browser/extensions/api/storage/settings_apitest.cc @@ -4,12 +4,12 @@ #include "base/bind.h" #include "base/json/json_writer.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_sync_util.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_test_message_listener.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_sync_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/extensions/value_builder.h" diff --git a/chrome/browser/extensions/settings/settings_backend.cc b/chrome/browser/extensions/api/storage/settings_backend.cc index 99ca5e3..1d8a5d5 100644 --- a/chrome/browser/extensions/settings/settings_backend.cc +++ b/chrome/browser/extensions/api/storage/settings_backend.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_backend.h" +#include "chrome/browser/extensions/api/storage/settings_backend.h" #include "base/file_util.h" #include "base/logging.h" -#include "chrome/browser/extensions/settings/settings_sync_processor.h" -#include "chrome/browser/extensions/settings/settings_sync_util.h" -#include "chrome/browser/extensions/settings/syncable_settings_storage.h" +#include "chrome/browser/extensions/api/storage/settings_sync_processor.h" +#include "chrome/browser/extensions/api/storage/settings_sync_util.h" +#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" #include "content/public/browser/browser_thread.h" #include "sync/api/sync_error_factory.h" diff --git a/chrome/browser/extensions/settings/settings_backend.h b/chrome/browser/extensions/api/storage/settings_backend.h index 9560c82..60073b2 100644 --- a/chrome/browser/extensions/settings/settings_backend.h +++ b/chrome/browser/extensions/api/storage/settings_backend.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_ #include <map> #include <set> @@ -14,9 +14,9 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/settings/settings_observer.h" -#include "chrome/browser/extensions/settings/settings_storage_factory.h" -#include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" +#include "chrome/browser/extensions/api/storage/settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" #include "sync/api/syncable_service.h" namespace syncer { @@ -113,4 +113,4 @@ class SettingsBackend : public syncer::SyncableService { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_ diff --git a/chrome/browser/extensions/settings/settings_frontend.cc b/chrome/browser/extensions/api/storage/settings_frontend.cc index b616edd0..240bc66 100644 --- a/chrome/browser/extensions/settings/settings_frontend.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_frontend.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include <limits> @@ -10,19 +10,19 @@ #include "base/bind_helpers.h" #include "base/file_path.h" #include "base/json/json_reader.h" +#include "chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_backend.h" +#include "chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.h" #include "chrome/browser/extensions/event_names.h" #include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" -#include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" -#include "chrome/browser/extensions/settings/settings_backend.h" -#include "chrome/browser/extensions/settings/sync_or_local_value_store_cache.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/storage.h" #include "content/public/browser/browser_thread.h" #if defined(ENABLE_CONFIGURATION_POLICY) -#include "chrome/browser/extensions/settings/managed_value_store_cache.h" +#include "chrome/browser/extensions/api/storage/managed_value_store_cache.h" #endif using content::BrowserThread; diff --git a/chrome/browser/extensions/settings/settings_frontend.h b/chrome/browser/extensions/api/storage/settings_frontend.h index 1c53d51..6c655bf 100644 --- a/chrome/browser/extensions/settings/settings_frontend.h +++ b/chrome/browser/extensions/api/storage/settings_frontend.h @@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_FRONTEND_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_FRONTEND_H_ #include <map> #include <string> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_observer.h" -#include "chrome/browser/extensions/settings/settings_storage_factory.h" -#include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" -#include "chrome/browser/extensions/settings/value_store_cache.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" +#include "chrome/browser/extensions/api/storage/settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" +#include "chrome/browser/extensions/api/storage/value_store_cache.h" #include "sync/api/syncable_service.h" class Profile; @@ -90,4 +90,4 @@ class SettingsFrontend { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_FRONTEND_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_FRONTEND_H_ diff --git a/chrome/browser/extensions/settings/settings_frontend_unittest.cc b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc index 34e2318..07a473d 100644 --- a/chrome/browser/extensions/settings/settings_frontend_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc @@ -2,21 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "testing/gtest/include/gtest/gtest.h" - #include "base/bind.h" #include "base/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/stringprintf.h" -#include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_test_util.h" +#include "chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_test_util.h" #include "chrome/browser/value_store/value_store.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/test/test_browser_thread.h" +#include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; diff --git a/chrome/browser/extensions/settings/settings_namespace.cc b/chrome/browser/extensions/api/storage/settings_namespace.cc index 82767ca..0b7ee3c 100644 --- a/chrome/browser/extensions/settings/settings_namespace.cc +++ b/chrome/browser/extensions/api/storage/settings_namespace.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" #include "base/logging.h" diff --git a/chrome/browser/extensions/settings/settings_namespace.h b/chrome/browser/extensions/api/storage/settings_namespace.h index c89658b..1047b45 100644 --- a/chrome/browser/extensions/settings/settings_namespace.h +++ b/chrome/browser/extensions/api/storage/settings_namespace.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_NAMESPACE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_NAMESPACE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_NAMESPACE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_NAMESPACE_H_ #include <string> @@ -31,4 +31,4 @@ Namespace FromString(const std::string& ns_string); } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_NAMESPACE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_NAMESPACE_H_ diff --git a/chrome/browser/extensions/settings/settings_observer.h b/chrome/browser/extensions/api/storage/settings_observer.h index f789b95..030713e 100644 --- a/chrome/browser/extensions/settings/settings_observer.h +++ b/chrome/browser/extensions/api/storage/settings_observer.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_OBSERVER_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_OBSERVER_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_OBSERVER_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_OBSERVER_H_ #include "base/observer_list_threadsafe.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" namespace extensions { @@ -27,4 +27,4 @@ typedef ObserverListThreadSafe<SettingsObserver> } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_OBSERVER_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_OBSERVER_H_ diff --git a/chrome/browser/extensions/settings/settings_quota_unittest.cc b/chrome/browser/extensions/api/storage/settings_quota_unittest.cc index c8b66c6..8ed71e8 100644 --- a/chrome/browser/extensions/settings/settings_quota_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_quota_unittest.cc @@ -2,15 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "testing/gtest/include/gtest/gtest.h" - #include "base/json/json_writer.h" -#include "base/values.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/settings/settings_backend.h" -#include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" +#include "base/values.h" +#include "chrome/browser/extensions/api/storage/settings_backend.h" +#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" #include "chrome/browser/value_store/testing_value_store.h" +#include "testing/gtest/include/gtest/gtest.h" namespace extensions { diff --git a/chrome/browser/extensions/settings/settings_storage_factory.h b/chrome/browser/extensions/api/storage/settings_storage_factory.h index 844e80d..4fce4f6 100644 --- a/chrome/browser/extensions/settings/settings_storage_factory.h +++ b/chrome/browser/extensions/api/storage/settings_storage_factory.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_ #include <string> @@ -33,4 +33,4 @@ class SettingsStorageFactory } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_FACTORY_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_FACTORY_H_ diff --git a/chrome/browser/extensions/settings/settings_storage_quota_enforcer.cc b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.cc index a4c81ef..cc48ec7 100644 --- a/chrome/browser/extensions/settings/settings_storage_quota_enforcer.cc +++ b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" +#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" #include "base/bind.h" #include "base/json/json_writer.h" diff --git a/chrome/browser/extensions/settings/settings_storage_quota_enforcer.h b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h index 2b71ff9..537ee33 100644 --- a/chrome/browser/extensions/settings/settings_storage_quota_enforcer.h +++ b/chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" @@ -66,4 +66,4 @@ class SettingsStorageQuotaEnforcer : public ValueStore { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ diff --git a/chrome/browser/extensions/settings/settings_sync_processor.cc b/chrome/browser/extensions/api/storage/settings_sync_processor.cc index 18c4f07..94de1b6 100644 --- a/chrome/browser/extensions/settings/settings_sync_processor.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_processor.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_sync_processor.h" -#include "chrome/browser/extensions/settings/settings_sync_util.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_sync_processor.h" +#include "chrome/browser/extensions/api/storage/settings_sync_util.h" #include "content/public/browser/browser_thread.h" #include "sync/api/sync_change_processor.h" #include "sync/api/sync_data.h" diff --git a/chrome/browser/extensions/settings/settings_sync_processor.h b/chrome/browser/extensions/api/storage/settings_sync_processor.h index cd39815..834e026 100644 --- a/chrome/browser/extensions/settings/settings_sync_processor.h +++ b/chrome/browser/extensions/api/storage/settings_sync_processor.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_PROCESSOR_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_PROCESSOR_H_ #include <set> #include <string> @@ -64,4 +64,4 @@ class SettingsSyncProcessor { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_PROCESSOR_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_PROCESSOR_H_ diff --git a/chrome/browser/extensions/settings/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc index 1386244..f8d65f0 100644 --- a/chrome/browser/extensions/settings/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -2,27 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "testing/gtest/include/gtest/gtest.h" - #include "base/bind.h" #include "base/files/scoped_temp_dir.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" +#include "chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" +#include "chrome/browser/extensions/api/storage/settings_storage_factory.h" +#include "chrome/browser/extensions/api/storage/settings_sync_util.h" +#include "chrome/browser/extensions/api/storage/settings_test_util.h" +#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" #include "chrome/browser/extensions/extension_system.h" -#include "chrome/browser/extensions/settings/leveldb_settings_storage_factory.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" -#include "chrome/browser/extensions/settings/settings_storage_factory.h" -#include "chrome/browser/extensions/settings/settings_sync_util.h" -#include "chrome/browser/extensions/settings/settings_test_util.h" -#include "chrome/browser/extensions/settings/syncable_settings_storage.h" #include "chrome/browser/extensions/test_extension_service.h" #include "chrome/browser/value_store/testing_value_store.h" #include "content/public/test/test_browser_thread.h" #include "sync/api/sync_change_processor.h" #include "sync/api/sync_error_factory.h" #include "sync/api/sync_error_factory_mock.h" +#include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; diff --git a/chrome/browser/extensions/settings/settings_sync_util.cc b/chrome/browser/extensions/api/storage/settings_sync_util.cc index 5c6c28a..b9246e0 100644 --- a/chrome/browser/extensions/settings/settings_sync_util.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_util.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_sync_util.h" +#include "chrome/browser/extensions/api/storage/settings_sync_util.h" #include "base/json/json_writer.h" #include "base/values.h" diff --git a/chrome/browser/extensions/settings/settings_sync_util.h b/chrome/browser/extensions/api/storage/settings_sync_util.h index 08769a3..0c6df046 100644 --- a/chrome/browser/extensions/settings/settings_sync_util.h +++ b/chrome/browser/extensions/api/storage/settings_sync_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_UTIL_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_UTIL_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_UTIL_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_UTIL_H_ #include "sync/api/sync_change.h" @@ -48,4 +48,4 @@ syncer::SyncChange CreateDelete( } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_SYNC_UTIL_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_SYNC_UTIL_H_ diff --git a/chrome/browser/extensions/settings/settings_test_util.cc b/chrome/browser/extensions/api/storage/settings_test_util.cc index 7f92850..bd90ae9 100644 --- a/chrome/browser/extensions/settings/settings_test_util.cc +++ b/chrome/browser/extensions/api/storage/settings_test_util.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_test_util.h" +#include "chrome/browser/extensions/api/storage/settings_test_util.h" #include "base/file_path.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include "chrome/browser/extensions/extension_system_factory.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" +#include "chrome/common/extensions/extension.h" namespace extensions { diff --git a/chrome/browser/extensions/settings/settings_test_util.h b/chrome/browser/extensions/api/storage/settings_test_util.h index d1f3e44..ee85b4e 100644 --- a/chrome/browser/extensions/settings/settings_test_util.h +++ b/chrome/browser/extensions/api/storage/settings_test_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_TEST_UTIL_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_TEST_UTIL_H_ #include <set> #include <string> @@ -12,10 +12,10 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_storage_factory.h" #include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_storage_factory.h" #include "chrome/browser/extensions/test_extension_service.h" #include "chrome/browser/extensions/test_extension_system.h" #include "chrome/common/extensions/extension.h" @@ -114,4 +114,4 @@ class ScopedSettingsStorageFactory : public SettingsStorageFactory { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_TEST_UTIL_H_ diff --git a/chrome/browser/extensions/settings/settings_api.cc b/chrome/browser/extensions/api/storage/storage_api.cc index 35f4eaf..8be3087 100644 --- a/chrome/browser/extensions/settings/settings_api.cc +++ b/chrome/browser/extensions/api/storage/storage_api.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/settings_api.h" +#include "chrome/browser/extensions/api/storage/storage_api.h" #include <string> #include <vector> @@ -10,9 +10,9 @@ #include "base/bind.h" #include "base/stringprintf.h" #include "base/values.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extensions_quota_service.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/storage.h" #include "content/public/browser/browser_thread.h" @@ -162,7 +162,7 @@ void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) { } // namespace -bool GetSettingsFunction::RunWithStorage(ValueStore* storage) { +bool StorageGetFunction::RunWithStorage(ValueStore* storage) { Value* input = NULL; EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); @@ -201,7 +201,7 @@ bool GetSettingsFunction::RunWithStorage(ValueStore* storage) { } } -bool GetBytesInUseSettingsFunction::RunWithStorage(ValueStore* storage) { +bool StorageGetBytesInUseFunction::RunWithStorage(ValueStore* storage) { Value* input = NULL; EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); @@ -235,18 +235,18 @@ bool GetBytesInUseSettingsFunction::RunWithStorage(ValueStore* storage) { return true; } -bool SetSettingsFunction::RunWithStorage(ValueStore* storage) { +bool StorageSetFunction::RunWithStorage(ValueStore* storage) { DictionaryValue* input = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &input)); return UseWriteResult(storage->Set(ValueStore::DEFAULTS, *input)); } -void SetSettingsFunction::GetQuotaLimitHeuristics( +void StorageSetFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { GetModificationQuotaLimitHeuristics(heuristics); } -bool RemoveSettingsFunction::RunWithStorage(ValueStore* storage) { +bool StorageRemoveFunction::RunWithStorage(ValueStore* storage) { Value* input = NULL; EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); @@ -269,16 +269,16 @@ bool RemoveSettingsFunction::RunWithStorage(ValueStore* storage) { }; } -void RemoveSettingsFunction::GetQuotaLimitHeuristics( +void StorageRemoveFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { GetModificationQuotaLimitHeuristics(heuristics); } -bool ClearSettingsFunction::RunWithStorage(ValueStore* storage) { +bool StorageClearFunction::RunWithStorage(ValueStore* storage) { return UseWriteResult(storage->Clear()); } -void ClearSettingsFunction::GetQuotaLimitHeuristics( +void StorageClearFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { GetModificationQuotaLimitHeuristics(heuristics); } diff --git a/chrome/browser/extensions/settings/settings_api.h b/chrome/browser/extensions/api/storage/storage_api.h index 38a18d5..b217f6d 100644 --- a/chrome/browser/extensions/settings/settings_api.h +++ b/chrome/browser/extensions/api/storage/storage_api.h @@ -2,24 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ #include "base/compiler_specific.h" #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/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_observer.h" #include "chrome/browser/value_store/value_store.h" namespace extensions { // Superclass of all settings functions. -// -// NOTE: these all have "*SettingsFunction" names left over from when the API -// was called the "Settings API" (now "Storage API"). -// TODO(kalman): Rename these functions, and all files under -// chrome/browser/extensions/settings. class SettingsFunction : public AsyncExtensionFunction { protected: SettingsFunction(); @@ -57,23 +52,23 @@ class SettingsFunction : public AsyncExtensionFunction { scoped_refptr<SettingsObserverList> observers_; }; -class GetSettingsFunction : public SettingsFunction { +class StorageGetFunction : public SettingsFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("storage.get"); protected: - virtual ~GetSettingsFunction() {} + virtual ~StorageGetFunction() {} // SettingsFunction: virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; }; -class SetSettingsFunction : public SettingsFunction { +class StorageSetFunction : public SettingsFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("storage.set"); protected: - virtual ~SetSettingsFunction() {} + virtual ~StorageSetFunction() {} // SettingsFunction: virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; @@ -83,12 +78,12 @@ class SetSettingsFunction : public SettingsFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; }; -class RemoveSettingsFunction : public SettingsFunction { +class StorageRemoveFunction : public SettingsFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("storage.remove"); protected: - virtual ~RemoveSettingsFunction() {} + virtual ~StorageRemoveFunction() {} // SettingsFunction: virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; @@ -98,12 +93,12 @@ class RemoveSettingsFunction : public SettingsFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; }; -class ClearSettingsFunction : public SettingsFunction { +class StorageClearFunction : public SettingsFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("storage.clear"); protected: - virtual ~ClearSettingsFunction() {} + virtual ~StorageClearFunction() {} // SettingsFunction: virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; @@ -113,12 +108,12 @@ class ClearSettingsFunction : public SettingsFunction { QuotaLimitHeuristics* heuristics) const OVERRIDE; }; -class GetBytesInUseSettingsFunction : public SettingsFunction { +class StorageGetBytesInUseFunction : public SettingsFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("storage.getBytesInUse"); protected: - virtual ~GetBytesInUseSettingsFunction() {} + virtual ~StorageGetBytesInUseFunction() {} // SettingsFunction: virtual bool RunWithStorage(ValueStore* storage) OVERRIDE; @@ -126,4 +121,4 @@ class GetBytesInUseSettingsFunction : public SettingsFunction { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_API_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_STORAGE_API_H_ diff --git a/chrome/browser/extensions/settings/sync_or_local_value_store_cache.cc b/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.cc index e3d951f..7855b46 100644 --- a/chrome/browser/extensions/settings/sync_or_local_value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.cc @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/sync_or_local_value_store_cache.h" +#include "chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.h" #include "base/bind.h" #include "base/callback.h" #include "base/file_path.h" #include "base/sequenced_task_runner.h" +#include "chrome/browser/extensions/api/storage/settings_backend.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" +#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" +#include "chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/settings/settings_backend.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" -#include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" -#include "chrome/browser/extensions/settings/weak_unlimited_settings_storage.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/permissions/api_permission.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/extensions/settings/sync_or_local_value_store_cache.h b/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.h index 05cd59e..8438b45 100644 --- a/chrome/browser/extensions/settings/sync_or_local_value_store_cache.h +++ b/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/settings/settings_observer.h" -#include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" -#include "chrome/browser/extensions/settings/value_store_cache.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" +#include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer.h" +#include "chrome/browser/extensions/api/storage/value_store_cache.h" class FilePath; @@ -59,4 +59,4 @@ class SyncOrLocalValueStoreCache : public ValueStoreCache { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ diff --git a/chrome/browser/extensions/settings/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc index c4edd9c..8f413a8 100644 --- a/chrome/browser/extensions/settings/syncable_settings_storage.cc +++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/syncable_settings_storage.h" +#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" -#include "chrome/browser/extensions/settings/settings_namespace.h" -#include "chrome/browser/extensions/settings/settings_sync_processor.h" -#include "chrome/browser/extensions/settings/settings_sync_util.h" +#include "chrome/browser/extensions/api/storage/settings_namespace.h" +#include "chrome/browser/extensions/api/storage/settings_sync_processor.h" +#include "chrome/browser/extensions/api/storage/settings_sync_util.h" #include "content/public/browser/browser_thread.h" #include "sync/api/sync_data.h" #include "sync/protocol/extension_setting_specifics.pb.h" diff --git a/chrome/browser/extensions/settings/syncable_settings_storage.h b/chrome/browser/extensions/api/storage/syncable_settings_storage.h index 993a226..ec57f83 100644 --- a/chrome/browser/extensions/settings/syncable_settings_storage.h +++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SYNCABLE_SETTINGS_STORAGE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_SYNCABLE_SETTINGS_STORAGE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list_threadsafe.h" #include "base/values.h" -#include "chrome/browser/extensions/settings/setting_sync_data.h" -#include "chrome/browser/extensions/settings/settings_observer.h" +#include "chrome/browser/extensions/api/storage/setting_sync_data.h" +#include "chrome/browser/extensions/api/storage/settings_observer.h" #include "chrome/browser/value_store/value_store.h" #include "sync/api/sync_change.h" #include "sync/api/syncable_service.h" @@ -108,4 +108,4 @@ class SyncableSettingsStorage : public ValueStore { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SYNCABLE_SETTINGS_STORAGE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ diff --git a/chrome/browser/extensions/settings/value_store_cache.cc b/chrome/browser/extensions/api/storage/value_store_cache.cc index 4d3fd70..bf68f7f 100644 --- a/chrome/browser/extensions/settings/value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/value_store_cache.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/value_store_cache.h" +#include "chrome/browser/extensions/api/storage/value_store_cache.h" namespace extensions { diff --git a/chrome/browser/extensions/settings/value_store_cache.h b/chrome/browser/extensions/api/storage/value_store_cache.h index b3322f8..9aacc76 100644 --- a/chrome/browser/extensions/settings/value_store_cache.h +++ b/chrome/browser/extensions/api/storage/value_store_cache.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_VALUE_STORE_CACHE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_VALUE_STORE_CACHE_H_ #include <string> @@ -54,4 +54,4 @@ class ValueStoreCache { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_VALUE_STORE_CACHE_H_ diff --git a/chrome/browser/extensions/settings/weak_unlimited_settings_storage.cc b/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.cc index 7afbc2c..7adf5f4 100644 --- a/chrome/browser/extensions/settings/weak_unlimited_settings_storage.cc +++ b/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/settings/weak_unlimited_settings_storage.h" +#include "chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h" namespace extensions { diff --git a/chrome/browser/extensions/settings/weak_unlimited_settings_storage.h b/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h index c9e6014..c74d57c 100644 --- a/chrome/browser/extensions/settings/weak_unlimited_settings_storage.h +++ b/chrome/browser/extensions/api/storage/weak_unlimited_settings_storage.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ -#define CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ +#define CHROME_BROWSER_EXTENSIONS_API_STORAGE_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ #include "base/compiler_specific.h" #include "chrome/browser/value_store/value_store.h" @@ -46,4 +46,4 @@ class WeakUnlimitedSettingsStorage : public ValueStore { } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ +#endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ diff --git a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc deleted file mode 100644 index 29a57d9..0000000 --- a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 2012 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/api/tabs/execute_code_in_tab_function.h" - -#include "base/bind.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "chrome/browser/extensions/api/tabs/tabs.h" -#include "chrome/browser/extensions/api/tabs/tabs_constants.h" -#include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/extension_tab_util.h" -#include "chrome/browser/extensions/file_reader.h" -#include "chrome/browser/extensions/script_executor.h" -#include "chrome/browser/extensions/tab_helper.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/common/extensions/api/tabs.h" -#include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_constants.h" -#include "chrome/common/extensions/extension_file_util.h" -#include "chrome/common/extensions/extension_l10n_util.h" -#include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_messages.h" -#include "chrome/common/extensions/message_bundle.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/web_contents.h" -#include "extensions/common/error_utils.h" - -using content::BrowserThread; -using extensions::api::tabs::InjectDetails; -using extensions::ErrorUtils; -using extensions::ScriptExecutor; -using extensions::UserScript; - -namespace keys = extensions::tabs_constants; - -ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() - : execute_tab_id_(-1) { -} - -ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} - -bool ExecuteCodeInTabFunction::HasPermission() { - if (Init() && - extension_->HasAPIPermissionForTab(execute_tab_id_, - extensions::APIPermission::kTab)) { - return true; - } - return ExtensionFunction::HasPermission(); -} - -bool ExecuteCodeInTabFunction::RunImpl() { - EXTENSION_FUNCTION_VALIDATE(Init()); - - if (!details_->code.get() && !details_->file.get()) { - error_ = keys::kNoCodeOrFileToExecuteError; - return false; - } - if (details_->code.get() && details_->file.get()) { - error_ = keys::kMoreThanOneValuesError; - return false; - } - - content::WebContents* contents = NULL; - - // 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 (!ExtensionTabUtil::GetTabById(execute_tab_id_, profile(), - include_incognito(), - NULL, NULL, &contents, NULL)) { - return false; - } - - // NOTE: This can give the wrong answer due to race conditions, but it is OK, - // we check again in the renderer. - CHECK(contents); - if (!GetExtension()->CanExecuteScriptOnPage(contents->GetURL(), - contents->GetURL(), - execute_tab_id_, - NULL, - &error_)) { - return false; - } - - if (details_->code.get()) - return Execute(*details_->code); - - CHECK(details_->file.get()); - resource_ = GetExtension()->GetResource(*details_->file); - - if (resource_.extension_root().empty() || resource_.relative_path().empty()) { - error_ = keys::kNoCodeOrFileToExecuteError; - return false; - } - - scoped_refptr<FileReader> file_reader(new FileReader( - resource_, base::Bind(&ExecuteCodeInTabFunction::DidLoadFile, this))); - file_reader->Start(); - - return true; -} - -void ExecuteCodeInTabFunction::OnExecuteCodeFinished(const std::string& error, - int32 on_page_id, - const GURL& on_url, - const ListValue& result) { - if (!error.empty()) - SetError(error); - - SendResponse(error.empty()); -} - -void TabsExecuteScriptFunction::OnExecuteCodeFinished(const std::string& error, - int32 on_page_id, - const GURL& on_url, - const ListValue& result) { - if (error.empty()) - SetResult(result.DeepCopy()); - ExecuteCodeInTabFunction::OnExecuteCodeFinished(error, on_page_id, on_url, - result); -} - -bool ExecuteCodeInTabFunction::Init() { - if (details_.get()) - return true; - - // |tab_id| is optional so it's ok if it's not there. - int tab_id = -1; - args_->GetInteger(0, &tab_id); - - // |details| are not optional. - DictionaryValue* details_value = NULL; - if (!args_->GetDictionary(1, &details_value)) - return false; - scoped_ptr<InjectDetails> details(new InjectDetails()); - if (!InjectDetails::Populate(*details_value, details.get())) - return false; - - // If the tab ID is -1 then it needs to be converted to the currently active - // tab's ID. - if (tab_id == -1) { - Browser* browser = GetCurrentBrowser(); - if (!browser) - return false; - content::WebContents* web_contents = NULL; - if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) - return false; - } - - execute_tab_id_ = tab_id; - details_ = details.Pass(); - return true; -} - -void ExecuteCodeInTabFunction::DidLoadFile(bool success, - const std::string& data) { - std::string function_name = name(); - const extensions::Extension* extension = GetExtension(); - - // Check if the file is CSS and needs localization. - if (success && - function_name == TabsInsertCSSFunction::function_name() && - extension != NULL && - data.find( - extensions::MessageBundle::kMessageBegin) != std::string::npos) { - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::Bind(&ExecuteCodeInTabFunction::LocalizeCSS, this, - data, - extension->id(), - extension->path(), - extension->default_locale())); - } else { - DidLoadAndLocalizeFile(success, data); - } -} - -void ExecuteCodeInTabFunction::LocalizeCSS( - const std::string& data, - const std::string& extension_id, - const FilePath& extension_path, - const std::string& extension_default_locale) { - scoped_ptr<SubstitutionMap> localization_messages( - extension_file_util::LoadMessageBundleSubstitutionMap( - extension_path, extension_id, extension_default_locale)); - - // We need to do message replacement on the data, so it has to be mutable. - std::string css_data = data; - std::string error; - extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( - *localization_messages, &css_data, &error); - - // Call back DidLoadAndLocalizeFile on the UI thread. The success parameter - // is always true, because if loading had failed, we wouldn't have had - // anything to localize. - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&ExecuteCodeInTabFunction::DidLoadAndLocalizeFile, this, - true, css_data)); -} - -void ExecuteCodeInTabFunction::DidLoadAndLocalizeFile(bool success, - const std::string& data) { - if (success) { - if (!Execute(data)) - SendResponse(false); - } else { -#if defined(OS_POSIX) - // TODO(viettrungluu): bug: there's no particular reason the path should be - // UTF-8, in which case this may fail. - error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, - resource_.relative_path().value()); -#elif defined(OS_WIN) - error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, - WideToUTF8(resource_.relative_path().value())); -#endif // OS_WIN - SendResponse(false); - } -} - -bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) { - content::WebContents* contents = NULL; - Browser* browser = NULL; - - bool success = ExtensionTabUtil::GetTabById( - execute_tab_id_, profile(), include_incognito(), &browser, NULL, - &contents, NULL) && contents && browser; - - if (!success) - return false; - - const extensions::Extension* extension = GetExtension(); - if (!extension) - return false; - - ScriptExecutor::ScriptType script_type = ScriptExecutor::JAVASCRIPT; - std::string function_name = name(); - if (function_name == TabsInsertCSSFunction::function_name()) { - script_type = ScriptExecutor::CSS; - } else if (function_name != TabsExecuteScriptFunction::function_name()) { - NOTREACHED(); - } - - ScriptExecutor::FrameScope frame_scope = - details_->all_frames.get() && *details_->all_frames ? - ScriptExecutor::ALL_FRAMES : - ScriptExecutor::TOP_FRAME; - - UserScript::RunLocation run_at = UserScript::UNDEFINED; - switch (details_->run_at) { - case InjectDetails::RUN_AT_NONE: - case InjectDetails::RUN_AT_DOCUMENT_IDLE: - run_at = UserScript::DOCUMENT_IDLE; - break; - case InjectDetails::RUN_AT_DOCUMENT_START: - run_at = UserScript::DOCUMENT_START; - break; - case InjectDetails::RUN_AT_DOCUMENT_END: - run_at = UserScript::DOCUMENT_END; - break; - } - CHECK_NE(UserScript::UNDEFINED, run_at); - - extensions::TabHelper::FromWebContents(contents)-> - script_executor()->ExecuteScript( - extension->id(), - script_type, - code_string, - frame_scope, - run_at, - ScriptExecutor::ISOLATED_WORLD, - base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); - return true; -} diff --git a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h deleted file mode 100644 index 7ce5ec1..0000000 --- a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2012 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_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ -#define CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ - -#include <string> - -#include "chrome/browser/extensions/extension_function.h" -#include "chrome/common/extensions/extension_resource.h" -#include "chrome/common/extensions/user_script.h" - -namespace extensions { -namespace api { -namespace tabs { -struct InjectDetails; -} // namespace tabs -} // namespace api -} // namespace extensions - -// Implement API call tabs.executeScript and tabs.insertCSS. -class ExecuteCodeInTabFunction : public AsyncExtensionFunction { - public: - ExecuteCodeInTabFunction(); - - protected: - virtual ~ExecuteCodeInTabFunction(); - - // ExtensionFunction: - virtual bool HasPermission() OVERRIDE; - virtual bool RunImpl() OVERRIDE; - - // Message handler. - virtual void OnExecuteCodeFinished(const std::string& error, - int32 on_page_id, - const GURL& on_url, - const ListValue& script_result); - - private: - // Initialize the |execute_tab_id_| and |details_| if they haven't already - // been. Returns whether initialization was successful. - bool Init(); - - // Called when contents from the file whose path is specified in JSON - // arguments has been loaded. - void DidLoadFile(bool success, const std::string& data); - - // Runs on FILE thread. Loads message bundles for the extension and - // localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread. - void LocalizeCSS( - const std::string& data, - const std::string& extension_id, - const FilePath& extension_path, - const std::string& extension_default_locale); - - // Called when contents from the loaded file have been localized. - void DidLoadAndLocalizeFile(bool success, const std::string& data); - - // Run in UI thread. Code string contains the code to be executed. Returns - // true on success. If true is returned, this does an AddRef. - bool Execute(const std::string& code_string); - - // Id of tab which executes code. - int execute_tab_id_; - - // The injection details. - scoped_ptr<extensions::api::tabs::InjectDetails> details_; - - // Contains extension resource built from path of file which is - // specified in JSON arguments. - ExtensionResource resource_; -}; - -class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { - private: - virtual ~TabsExecuteScriptFunction() {} - - virtual void OnExecuteCodeFinished(const std::string& error, - int32 on_page_id, - const GURL& on_url, - const ListValue& script_result) OVERRIDE; - - DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") -}; - -class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { - private: - virtual ~TabsInsertCSSFunction() {} - - DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") -}; - -#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_EXECUTE_CODE_IN_TAB_FUNCTION_H__ diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index 342b630..441f422 100644 --- a/chrome/browser/extensions/api/tabs/tabs.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/tabs/tabs.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include <algorithm> #include <limits> @@ -26,6 +26,7 @@ #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_tab_util.h" +#include "chrome/browser/extensions/file_reader.h" #include "chrome/browser/extensions/script_executor.h" #include "chrome/browser/extensions/tab_helper.h" #include "chrome/browser/extensions/window_controller.h" @@ -50,10 +51,15 @@ #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/api/tabs.h" #include "chrome/common/extensions/api/windows.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_constants.h" +#include "chrome/common/extensions/extension_file_util.h" +#include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_messages.h" +#include "chrome/common/extensions/message_bundle.h" #include "chrome/common/extensions/user_script.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -87,6 +93,7 @@ namespace GetLastFocused = extensions::api::windows::GetLastFocused; namespace errors = extension_manifest_errors; namespace keys = extensions::tabs_constants; +using content::BrowserThread; using content::NavigationController; using content::NavigationEntry; using content::OpenURLParams; @@ -95,10 +102,12 @@ using content::RenderViewHost; using content::WebContents; using extensions::ErrorUtils; using extensions::ScriptExecutor; +using extensions::UserScript; using extensions::WindowController; using extensions::WindowControllerList; +using extensions::api::tabs::InjectDetails; -const int CaptureVisibleTabFunction::kDefaultQuality = 90; +const int TabsCaptureVisibleTabFunction::kDefaultQuality = 90; namespace { @@ -249,7 +258,7 @@ Browser* CreateBrowserWindow(const Browser::CreateParams& params, // Windows --------------------------------------------------------------------- -bool GetWindowFunction::RunImpl() { +bool WindowsGetFunction::RunImpl() { scoped_ptr<Get::Params> params(Get::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -268,7 +277,7 @@ bool GetWindowFunction::RunImpl() { return true; } -bool GetCurrentWindowFunction::RunImpl() { +bool WindowsGetCurrentFunction::RunImpl() { scoped_ptr<GetCurrent::Params> params(GetCurrent::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -289,7 +298,7 @@ bool GetCurrentWindowFunction::RunImpl() { return true; } -bool GetLastFocusedWindowFunction::RunImpl() { +bool WindowsGetLastFocusedFunction::RunImpl() { scoped_ptr<GetLastFocused::Params> params( GetLastFocused::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -316,7 +325,7 @@ bool GetLastFocusedWindowFunction::RunImpl() { return true; } -bool GetAllWindowsFunction::RunImpl() { +bool WindowsGetAllFunction::RunImpl() { scoped_ptr<GetAll::Params> params(GetAll::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -341,7 +350,7 @@ bool GetAllWindowsFunction::RunImpl() { return true; } -bool CreateWindowFunction::ShouldOpenIncognitoWindow( +bool WindowsCreateFunction::ShouldOpenIncognitoWindow( const base::DictionaryValue* args, std::vector<GURL>* urls, bool* is_error) { @@ -391,7 +400,7 @@ bool CreateWindowFunction::ShouldOpenIncognitoWindow( return incognito; } -bool CreateWindowFunction::RunImpl() { +bool WindowsCreateFunction::RunImpl() { DictionaryValue* args = NULL; std::vector<GURL> urls; WebContents* contents = NULL; @@ -660,7 +669,7 @@ bool CreateWindowFunction::RunImpl() { return true; } -bool UpdateWindowFunction::RunImpl() { +bool WindowsUpdateFunction::RunImpl() { int window_id = extension_misc::kUnknownWindowId; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); DictionaryValue* update_props; @@ -804,7 +813,7 @@ bool UpdateWindowFunction::RunImpl() { return true; } -bool RemoveWindowFunction::RunImpl() { +bool WindowsRemoveFunction::RunImpl() { int window_id = -1; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); @@ -831,7 +840,7 @@ bool RemoveWindowFunction::RunImpl() { // Tabs ------------------------------------------------------------------------ -bool GetSelectedTabFunction::RunImpl() { +bool TabsGetSelectedFunction::RunImpl() { // windowId defaults to "current" window. int window_id = extension_misc::kCurrentWindowId; @@ -855,7 +864,7 @@ bool GetSelectedTabFunction::RunImpl() { return true; } -bool GetAllTabsInWindowFunction::RunImpl() { +bool TabsGetAllInWindowFunction::RunImpl() { // windowId defaults to "current" window. int window_id = extension_misc::kCurrentWindowId; if (HasOptionalArgument(0)) @@ -870,7 +879,7 @@ bool GetAllTabsInWindowFunction::RunImpl() { return true; } -bool QueryTabsFunction::RunImpl() { +bool TabsQueryFunction::RunImpl() { DictionaryValue* query = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &query)); @@ -983,7 +992,7 @@ bool QueryTabsFunction::RunImpl() { return true; } -bool CreateTabFunction::RunImpl() { +bool TabsCreateFunction::RunImpl() { DictionaryValue* args = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); @@ -1117,7 +1126,7 @@ bool CreateTabFunction::RunImpl() { return true; } -bool DuplicateTabFunction::RunImpl() { +bool TabsDuplicateFunction::RunImpl() { int tab_id = -1; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); @@ -1143,7 +1152,7 @@ bool DuplicateTabFunction::RunImpl() { return true; } -bool GetTabFunction::RunImpl() { +bool TabsGetFunction::RunImpl() { int tab_id = -1; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); @@ -1161,7 +1170,7 @@ bool GetTabFunction::RunImpl() { return true; } -bool GetCurrentTabFunction::RunImpl() { +bool TabsGetCurrentFunction::RunImpl() { DCHECK(dispatcher()); WebContents* contents = dispatcher()->delegate()->GetAssociatedWebContents(); @@ -1171,7 +1180,7 @@ bool GetCurrentTabFunction::RunImpl() { return true; } -bool HighlightTabsFunction::RunImpl() { +bool TabsHighlightFunction::RunImpl() { DictionaryValue* info = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &info)); @@ -1228,10 +1237,10 @@ bool HighlightTabsFunction::RunImpl() { return true; } -UpdateTabFunction::UpdateTabFunction() : web_contents_(NULL) { +TabsUpdateFunction::TabsUpdateFunction() : web_contents_(NULL) { } -bool UpdateTabFunction::RunImpl() { +bool TabsUpdateFunction::RunImpl() { DictionaryValue* update_props = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); @@ -1335,7 +1344,7 @@ bool UpdateTabFunction::RunImpl() { return true; } -bool UpdateTabFunction::UpdateURLIfPresent(DictionaryValue* update_props, +bool TabsUpdateFunction::UpdateURLIfPresent(DictionaryValue* update_props, int tab_id, bool* is_async) { if (!update_props->HasKey(keys::kUrlKey)) @@ -1379,7 +1388,7 @@ bool UpdateTabFunction::UpdateURLIfPresent(DictionaryValue* update_props, ScriptExecutor::TOP_FRAME, extensions::UserScript::DOCUMENT_IDLE, ScriptExecutor::MAIN_WORLD, - base::Bind(&UpdateTabFunction::OnExecuteCodeFinished, this)); + base::Bind(&TabsUpdateFunction::OnExecuteCodeFinished, this)); *is_async = true; return true; @@ -1396,14 +1405,14 @@ bool UpdateTabFunction::UpdateURLIfPresent(DictionaryValue* update_props, return true; } -void UpdateTabFunction::PopulateResult() { +void TabsUpdateFunction::PopulateResult() { if (!has_callback()) return; SetResult(ExtensionTabUtil::CreateTabValue(web_contents_, GetExtension())); } -void UpdateTabFunction::OnExecuteCodeFinished(const std::string& error, +void TabsUpdateFunction::OnExecuteCodeFinished(const std::string& error, int32 on_page_id, const GURL& url, const ListValue& script_result) { @@ -1414,7 +1423,7 @@ void UpdateTabFunction::OnExecuteCodeFinished(const std::string& error, SendResponse(error.empty()); } -bool MoveTabsFunction::RunImpl() { +bool TabsMoveFunction::RunImpl() { Value* tab_value = NULL; EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &tab_value)); @@ -1535,7 +1544,7 @@ bool MoveTabsFunction::RunImpl() { return true; } -bool ReloadTabFunction::RunImpl() { +bool TabsReloadFunction::RunImpl() { bool bypass_cache = false; if (HasOptionalArgument(1)) { DictionaryValue* reload_props = NULL; @@ -1590,7 +1599,7 @@ bool ReloadTabFunction::RunImpl() { return true; } -bool RemoveTabsFunction::RunImpl() { +bool TabsRemoveFunction::RunImpl() { Value* tab_value = NULL; EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &tab_value)); @@ -1620,7 +1629,8 @@ bool RemoveTabsFunction::RunImpl() { return true; } -bool CaptureVisibleTabFunction::GetTabToCapture(WebContents** web_contents) { +bool TabsCaptureVisibleTabFunction::GetTabToCapture( + WebContents** web_contents) { Browser* browser = NULL; // windowId defaults to "current" window. int window_id = extension_misc::kCurrentWindowId; @@ -1640,7 +1650,7 @@ bool CaptureVisibleTabFunction::GetTabToCapture(WebContents** web_contents) { return true; }; -bool CaptureVisibleTabFunction::RunImpl() { +bool TabsCaptureVisibleTabFunction::RunImpl() { PrefServiceBase* service = profile()->GetPrefs(); if (service->GetBoolean(prefs::kDisableScreenshots)) { error_ = keys::kScreenshotsDisabled; @@ -1699,14 +1709,14 @@ bool CaptureVisibleTabFunction::RunImpl() { render_view_host->CopyFromBackingStore( gfx::Rect(), view->GetViewBounds().size(), - base::Bind(&CaptureVisibleTabFunction::CopyFromBackingStoreComplete, + base::Bind(&TabsCaptureVisibleTabFunction::CopyFromBackingStoreComplete, this, base::Owned(temp_bitmap)), temp_bitmap); return true; } -void CaptureVisibleTabFunction::CopyFromBackingStoreComplete( +void TabsCaptureVisibleTabFunction::CopyFromBackingStoreComplete( skia::PlatformBitmap* bitmap, bool succeeded) { if (succeeded) { @@ -1726,14 +1736,14 @@ void CaptureVisibleTabFunction::CopyFromBackingStoreComplete( registrar_.Add(this, chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, content::Source<WebContents>(web_contents)); - AddRef(); // Balanced in CaptureVisibleTabFunction::Observe(). + AddRef(); // Balanced in TabsCaptureVisibleTabFunction::Observe(). SnapshotTabHelper::FromWebContents(web_contents)->CaptureSnapshot(); } -// If a backing store was not available in CaptureVisibleTabFunction::RunImpl, -// than the renderer was asked for a snapshot. Listen for a notification -// that the snapshot is available. -void CaptureVisibleTabFunction::Observe( +// If a backing store was not available in +// TabsCaptureVisibleTabFunction::RunImpl, than the renderer was asked for a +// snapshot. Listen for a notification that the snapshot is available. +void TabsCaptureVisibleTabFunction::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -1751,12 +1761,12 @@ void CaptureVisibleTabFunction::Observe( SendResultFromBitmap(*screen_capture); } - Release(); // Balanced in CaptureVisibleTabFunction::RunImpl(). + Release(); // Balanced in TabsCaptureVisibleTabFunction::RunImpl(). } // Turn a bitmap of the screen into an image, set that image as the result, // and call SendResponse(). -void CaptureVisibleTabFunction::SendResultFromBitmap( +void TabsCaptureVisibleTabFunction::SendResultFromBitmap( const SkBitmap& screen_capture) { std::vector<unsigned char> data; SkAutoLockPixels screen_capture_lock(screen_capture); @@ -1802,13 +1812,13 @@ void CaptureVisibleTabFunction::SendResultFromBitmap( SendResponse(true); } -void CaptureVisibleTabFunction::RegisterUserPrefs( +void TabsCaptureVisibleTabFunction::RegisterUserPrefs( PrefServiceSyncable* service) { service->RegisterBooleanPref(prefs::kDisableScreenshots, false, PrefServiceSyncable::UNSYNCABLE_PREF); } -bool DetectTabLanguageFunction::RunImpl() { +bool TabsDetectLanguageFunction::RunImpl() { int tab_id = 0; Browser* browser = NULL; WebContents* contents = NULL; @@ -1846,7 +1856,7 @@ bool DetectTabLanguageFunction::RunImpl() { // Delay the callback invocation until after the current JS call has // returned. MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &DetectTabLanguageFunction::GotLanguage, this, + &TabsDetectLanguageFunction::GotLanguage, this, translate_tab_helper->language_state().original_language())); return true; } @@ -1863,7 +1873,7 @@ bool DetectTabLanguageFunction::RunImpl() { return true; } -void DetectTabLanguageFunction::Observe( +void TabsDetectLanguageFunction::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -1878,9 +1888,249 @@ void DetectTabLanguageFunction::Observe( GotLanguage(language); } -void DetectTabLanguageFunction::GotLanguage(const std::string& language) { +void TabsDetectLanguageFunction::GotLanguage(const std::string& language) { SetResult(Value::CreateStringValue(language.c_str())); SendResponse(true); Release(); // Balanced in Run() } + +ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() + : execute_tab_id_(-1) { +} + +ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} + +bool ExecuteCodeInTabFunction::HasPermission() { + if (Init() && + extension_->HasAPIPermissionForTab(execute_tab_id_, + extensions::APIPermission::kTab)) { + return true; + } + return ExtensionFunction::HasPermission(); +} + +bool ExecuteCodeInTabFunction::RunImpl() { + EXTENSION_FUNCTION_VALIDATE(Init()); + + if (!details_->code.get() && !details_->file.get()) { + error_ = keys::kNoCodeOrFileToExecuteError; + return false; + } + if (details_->code.get() && details_->file.get()) { + error_ = keys::kMoreThanOneValuesError; + return false; + } + + content::WebContents* contents = NULL; + + // 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 (!ExtensionTabUtil::GetTabById(execute_tab_id_, profile(), + include_incognito(), + NULL, NULL, &contents, NULL)) { + return false; + } + + // NOTE: This can give the wrong answer due to race conditions, but it is OK, + // we check again in the renderer. + CHECK(contents); + if (!GetExtension()->CanExecuteScriptOnPage(contents->GetURL(), + contents->GetURL(), + execute_tab_id_, + NULL, + &error_)) { + return false; + } + + if (details_->code.get()) + return Execute(*details_->code); + + CHECK(details_->file.get()); + resource_ = GetExtension()->GetResource(*details_->file); + + if (resource_.extension_root().empty() || resource_.relative_path().empty()) { + error_ = keys::kNoCodeOrFileToExecuteError; + return false; + } + + scoped_refptr<FileReader> file_reader(new FileReader( + resource_, base::Bind(&ExecuteCodeInTabFunction::DidLoadFile, this))); + file_reader->Start(); + + return true; +} + +void ExecuteCodeInTabFunction::OnExecuteCodeFinished(const std::string& error, + int32 on_page_id, + const GURL& on_url, + const ListValue& result) { + if (!error.empty()) + SetError(error); + + SendResponse(error.empty()); +} + +void TabsExecuteScriptFunction::OnExecuteCodeFinished(const std::string& error, + int32 on_page_id, + const GURL& on_url, + const ListValue& result) { + if (error.empty()) + SetResult(result.DeepCopy()); + ExecuteCodeInTabFunction::OnExecuteCodeFinished(error, on_page_id, on_url, + result); +} + +bool ExecuteCodeInTabFunction::Init() { + if (details_.get()) + return true; + + // |tab_id| is optional so it's ok if it's not there. + int tab_id = -1; + args_->GetInteger(0, &tab_id); + + // |details| are not optional. + DictionaryValue* details_value = NULL; + if (!args_->GetDictionary(1, &details_value)) + return false; + scoped_ptr<InjectDetails> details(new InjectDetails()); + if (!InjectDetails::Populate(*details_value, details.get())) + return false; + + // If the tab ID is -1 then it needs to be converted to the currently active + // tab's ID. + if (tab_id == -1) { + Browser* browser = GetCurrentBrowser(); + if (!browser) + return false; + content::WebContents* web_contents = NULL; + if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) + return false; + } + + execute_tab_id_ = tab_id; + details_ = details.Pass(); + return true; +} + +void ExecuteCodeInTabFunction::DidLoadFile(bool success, + const std::string& data) { + std::string function_name = name(); + const extensions::Extension* extension = GetExtension(); + + // Check if the file is CSS and needs localization. + if (success && + function_name == TabsInsertCSSFunction::function_name() && + extension != NULL && + data.find( + extensions::MessageBundle::kMessageBegin) != std::string::npos) { + BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, + base::Bind(&ExecuteCodeInTabFunction::LocalizeCSS, this, + data, + extension->id(), + extension->path(), + extension->default_locale())); + } else { + DidLoadAndLocalizeFile(success, data); + } +} + +void ExecuteCodeInTabFunction::LocalizeCSS( + const std::string& data, + const std::string& extension_id, + const FilePath& extension_path, + const std::string& extension_default_locale) { + scoped_ptr<SubstitutionMap> localization_messages( + extension_file_util::LoadMessageBundleSubstitutionMap( + extension_path, extension_id, extension_default_locale)); + + // We need to do message replacement on the data, so it has to be mutable. + std::string css_data = data; + std::string error; + extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( + *localization_messages, &css_data, &error); + + // Call back DidLoadAndLocalizeFile on the UI thread. The success parameter + // is always true, because if loading had failed, we wouldn't have had + // anything to localize. + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&ExecuteCodeInTabFunction::DidLoadAndLocalizeFile, this, + true, css_data)); +} + +void ExecuteCodeInTabFunction::DidLoadAndLocalizeFile(bool success, + const std::string& data) { + if (success) { + if (!Execute(data)) + SendResponse(false); + } else { +#if defined(OS_POSIX) + // TODO(viettrungluu): bug: there's no particular reason the path should be + // UTF-8, in which case this may fail. + error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, + resource_.relative_path().value()); +#elif defined(OS_WIN) + error_ = ErrorUtils::FormatErrorMessage(keys::kLoadFileError, + WideToUTF8(resource_.relative_path().value())); +#endif // OS_WIN + SendResponse(false); + } +} + +bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) { + content::WebContents* contents = NULL; + Browser* browser = NULL; + + bool success = ExtensionTabUtil::GetTabById( + execute_tab_id_, profile(), include_incognito(), &browser, NULL, + &contents, NULL) && contents && browser; + + if (!success) + return false; + + const extensions::Extension* extension = GetExtension(); + if (!extension) + return false; + + ScriptExecutor::ScriptType script_type = ScriptExecutor::JAVASCRIPT; + std::string function_name = name(); + if (function_name == TabsInsertCSSFunction::function_name()) { + script_type = ScriptExecutor::CSS; + } else if (function_name != TabsExecuteScriptFunction::function_name()) { + NOTREACHED(); + } + + ScriptExecutor::FrameScope frame_scope = + details_->all_frames.get() && *details_->all_frames ? + ScriptExecutor::ALL_FRAMES : + ScriptExecutor::TOP_FRAME; + + UserScript::RunLocation run_at = UserScript::UNDEFINED; + switch (details_->run_at) { + case InjectDetails::RUN_AT_NONE: + case InjectDetails::RUN_AT_DOCUMENT_IDLE: + run_at = UserScript::DOCUMENT_IDLE; + break; + case InjectDetails::RUN_AT_DOCUMENT_START: + run_at = UserScript::DOCUMENT_START; + break; + case InjectDetails::RUN_AT_DOCUMENT_END: + run_at = UserScript::DOCUMENT_END; + break; + } + CHECK_NE(UserScript::UNDEFINED, run_at); + + extensions::TabHelper::FromWebContents(contents)-> + script_executor()->ExecuteScript( + extension->id(), + script_type, + code_string, + frame_scope, + run_at, + ScriptExecutor::ISOLATED_WORLD, + base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); + return true; +} diff --git a/chrome/browser/extensions/api/tabs/tabs.h b/chrome/browser/extensions/api/tabs/tabs_api.h index 5011c3f..db362cc 100644 --- a/chrome/browser/extensions/api/tabs/tabs.h +++ b/chrome/browser/extensions/api/tabs/tabs_api.h @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ -#define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ +#ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ +#define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ #include <string> #include <vector> #include "base/compiler_specific.h" #include "chrome/browser/extensions/extension_function.h" +#include "chrome/common/extensions/extension_resource.h" +#include "chrome/common/extensions/user_script.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "googleurl/src/gurl.h" @@ -27,33 +29,41 @@ namespace content { class WebContents; } +namespace extensions { +namespace api { +namespace tabs { +struct InjectDetails; +} // namespace tabs +} // namespace api +} // namespace extensions + namespace skia { class PlatformBitmap; } // Windows -class GetWindowFunction : public SyncExtensionFunction { - virtual ~GetWindowFunction() {} +class WindowsGetFunction : public SyncExtensionFunction { + virtual ~WindowsGetFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("windows.get") }; -class GetCurrentWindowFunction : public SyncExtensionFunction { - virtual ~GetCurrentWindowFunction() {} +class WindowsGetCurrentFunction : public SyncExtensionFunction { + virtual ~WindowsGetCurrentFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent") }; -class GetLastFocusedWindowFunction : public SyncExtensionFunction { - virtual ~GetLastFocusedWindowFunction() {} +class WindowsGetLastFocusedFunction : public SyncExtensionFunction { + virtual ~WindowsGetLastFocusedFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("windows.getLastFocused") }; -class GetAllWindowsFunction : public SyncExtensionFunction { - virtual ~GetAllWindowsFunction() {} +class WindowsGetAllFunction : public SyncExtensionFunction { + virtual ~WindowsGetAllFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("windows.getAll") }; -class CreateWindowFunction : public SyncExtensionFunction { - virtual ~CreateWindowFunction() {} +class WindowsCreateFunction : public SyncExtensionFunction { + virtual ~WindowsCreateFunction() {} virtual bool RunImpl() OVERRIDE; // Returns whether the window should be created in incognito mode. // |urls| is the list of urls to open. If we are creating an incognito window, @@ -66,64 +76,64 @@ class CreateWindowFunction : public SyncExtensionFunction { bool* is_error); DECLARE_EXTENSION_FUNCTION_NAME("windows.create") }; -class UpdateWindowFunction : public SyncExtensionFunction { - virtual ~UpdateWindowFunction() {} +class WindowsUpdateFunction : public SyncExtensionFunction { + virtual ~WindowsUpdateFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("windows.update") }; -class RemoveWindowFunction : public SyncExtensionFunction { - virtual ~RemoveWindowFunction() {} +class WindowsRemoveFunction : public SyncExtensionFunction { + virtual ~WindowsRemoveFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("windows.remove") }; // Tabs -class GetTabFunction : public SyncExtensionFunction { - virtual ~GetTabFunction() {} +class TabsGetFunction : public SyncExtensionFunction { + virtual ~TabsGetFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.get") }; -class GetCurrentTabFunction : public SyncExtensionFunction { - virtual ~GetCurrentTabFunction() {} +class TabsGetCurrentFunction : public SyncExtensionFunction { + virtual ~TabsGetCurrentFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.getCurrent") }; -class GetSelectedTabFunction : public SyncExtensionFunction { - virtual ~GetSelectedTabFunction() {} +class TabsGetSelectedFunction : public SyncExtensionFunction { + virtual ~TabsGetSelectedFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.getSelected") }; -class GetAllTabsInWindowFunction : public SyncExtensionFunction { - virtual ~GetAllTabsInWindowFunction() {} +class TabsGetAllInWindowFunction : public SyncExtensionFunction { + virtual ~TabsGetAllInWindowFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.getAllInWindow") }; -class QueryTabsFunction : public SyncExtensionFunction { - virtual ~QueryTabsFunction() {} +class TabsQueryFunction : public SyncExtensionFunction { + virtual ~TabsQueryFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.query") }; -class CreateTabFunction : public SyncExtensionFunction { - virtual ~CreateTabFunction() {} +class TabsCreateFunction : public SyncExtensionFunction { + virtual ~TabsCreateFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.create") }; -class DuplicateTabFunction : public SyncExtensionFunction { - virtual ~DuplicateTabFunction() {} +class TabsDuplicateFunction : public SyncExtensionFunction { + virtual ~TabsDuplicateFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.duplicate") }; -class HighlightTabsFunction : public SyncExtensionFunction { - virtual ~HighlightTabsFunction() {} +class TabsHighlightFunction : public SyncExtensionFunction { + virtual ~TabsHighlightFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight") }; -class UpdateTabFunction : public AsyncExtensionFunction { +class TabsUpdateFunction : public AsyncExtensionFunction { public: - UpdateTabFunction(); + TabsUpdateFunction(); protected: - virtual ~UpdateTabFunction() {} + virtual ~TabsUpdateFunction() {} virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props, int tab_id, bool* is_async); @@ -140,25 +150,25 @@ class UpdateTabFunction : public AsyncExtensionFunction { DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") }; -class MoveTabsFunction : public SyncExtensionFunction { - virtual ~MoveTabsFunction() {} +class TabsMoveFunction : public SyncExtensionFunction { + virtual ~TabsMoveFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") }; -class ReloadTabFunction : public SyncExtensionFunction { - virtual ~ReloadTabFunction() {} +class TabsReloadFunction : public SyncExtensionFunction { + virtual ~TabsReloadFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.reload") }; -class RemoveTabsFunction : public SyncExtensionFunction { - virtual ~RemoveTabsFunction() {} +class TabsRemoveFunction : public SyncExtensionFunction { + virtual ~TabsRemoveFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("tabs.remove") }; -class DetectTabLanguageFunction : public AsyncExtensionFunction, +class TabsDetectLanguageFunction : public AsyncExtensionFunction, public content::NotificationObserver { private: - virtual ~DetectTabLanguageFunction() {} + virtual ~TabsDetectLanguageFunction() {} virtual bool RunImpl() OVERRIDE; virtual void Observe(int type, @@ -168,7 +178,7 @@ class DetectTabLanguageFunction : public AsyncExtensionFunction, content::NotificationRegistrar registrar_; DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage") }; -class CaptureVisibleTabFunction : public AsyncExtensionFunction, +class TabsCaptureVisibleTabFunction : public AsyncExtensionFunction, public content::NotificationObserver { public: static void RegisterUserPrefs(PrefServiceSyncable* service); @@ -182,7 +192,7 @@ class CaptureVisibleTabFunction : public AsyncExtensionFunction, // The default quality setting used when encoding jpegs. static const int kDefaultQuality; - virtual ~CaptureVisibleTabFunction() {} + virtual ~TabsCaptureVisibleTabFunction() {} virtual bool RunImpl() OVERRIDE; virtual bool GetTabToCapture(content::WebContents** web_contents); virtual void Observe(int type, @@ -205,4 +215,76 @@ class CaptureVisibleTabFunction : public AsyncExtensionFunction, DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") }; -#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_H__ +// Implement API call tabs.executeScript and tabs.insertCSS. +class ExecuteCodeInTabFunction : public AsyncExtensionFunction { + public: + ExecuteCodeInTabFunction(); + + protected: + virtual ~ExecuteCodeInTabFunction(); + + // ExtensionFunction: + virtual bool HasPermission() OVERRIDE; + virtual bool RunImpl() OVERRIDE; + + // Message handler. + virtual void OnExecuteCodeFinished(const std::string& error, + int32 on_page_id, + const GURL& on_url, + const ListValue& script_result); + + private: + // Initialize the |execute_tab_id_| and |details_| if they haven't already + // been. Returns whether initialization was successful. + bool Init(); + + // Called when contents from the file whose path is specified in JSON + // arguments has been loaded. + void DidLoadFile(bool success, const std::string& data); + + // Runs on FILE thread. Loads message bundles for the extension and + // localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread. + void LocalizeCSS( + const std::string& data, + const std::string& extension_id, + const FilePath& extension_path, + const std::string& extension_default_locale); + + // Called when contents from the loaded file have been localized. + void DidLoadAndLocalizeFile(bool success, const std::string& data); + + // Run in UI thread. Code string contains the code to be executed. Returns + // true on success. If true is returned, this does an AddRef. + bool Execute(const std::string& code_string); + + // Id of tab which executes code. + int execute_tab_id_; + + // The injection details. + scoped_ptr<extensions::api::tabs::InjectDetails> details_; + + // Contains extension resource built from path of file which is + // specified in JSON arguments. + ExtensionResource resource_; +}; + +class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { + private: + virtual ~TabsExecuteScriptFunction() {} + + virtual void OnExecuteCodeFinished(const std::string& error, + int32 on_page_id, + const GURL& on_url, + const ListValue& script_result) OVERRIDE; + + DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript") +}; + +class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { + private: + virtual ~TabsInsertCSSFunction() {} + + DECLARE_EXTENSION_FUNCTION_NAME("tabs.insertCSS") +}; + +#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ diff --git a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc index c5a0dd5..c18a161 100644 --- a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc +++ b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc @@ -2,17 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/tabs/tabs.h" - #include "base/values.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/api/tabs/tabs_constants.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" namespace keys = extensions::tabs_constants; @@ -32,8 +31,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, MAYBE_GetLastFocusedWindow) { Browser* new_browser = CreateBrowser(browser()->profile()); int focused_window_id = ExtensionTabUtil::GetWindowId(new_browser); - scoped_refptr<GetLastFocusedWindowFunction> function = - new GetLastFocusedWindowFunction(); + scoped_refptr<WindowsGetLastFocusedFunction> function = + new WindowsGetLastFocusedFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( @@ -47,7 +46,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, MAYBE_GetLastFocusedWindow) { ListValue* tabs = NULL; EXPECT_FALSE(result.get()->GetList(keys::kTabsKey, &tabs)); - function = new GetLastFocusedWindowFunction(); + function = new WindowsGetLastFocusedFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -83,7 +82,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DISABLED_QueryLastFocusedWindowTabs) { int focused_window_id = ExtensionTabUtil::GetWindowId(focused_window); // Get tabs in the 'last focused' window called from non-focused browser. - scoped_refptr<QueryTabsFunction> function = new QueryTabsFunction(); + scoped_refptr<TabsQueryFunction> function = new TabsQueryFunction(); scoped_ptr<base::ListValue> result(utils::ToList( utils::RunFunctionAndReturnSingleResult(function.get(), "[{\"lastFocusedWindow\":true}]", @@ -100,7 +99,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DISABLED_QueryLastFocusedWindowTabs) { } // Get tabs NOT in the 'last focused' window called from the focused browser. - function = new QueryTabsFunction(); + function = new TabsQueryFunction(); result.reset(utils::ToList( utils::RunFunctionAndReturnSingleResult(function.get(), "[{\"lastFocusedWindow\":false}]", diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc index 30f192c..ec96b6a 100644 --- a/chrome/browser/extensions/api/tabs/tabs_test.cc +++ b/chrome/browser/extensions/api/tabs/tabs_test.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/api/tabs/tabs.h" #include <string> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "base/stringprintf.h" #include "base/string_util.h" +#include "base/stringprintf.h" #include "base/values.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/api/tabs/tabs_constants.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_tab_util.h" @@ -38,7 +38,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { int window_id = ExtensionTabUtil::GetWindowId(browser()); // Invalid window ID error. - scoped_refptr<GetWindowFunction> function = new GetWindowFunction(); + scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( @@ -55,7 +55,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { else bounds = browser()->window()->GetBounds(); - function = new GetWindowFunction(); + function = new WindowsGetFunction(); function->set_extension(extension.get()); scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult( @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { EXPECT_EQ(bounds.height(), utils::GetInteger(result.get(), "height")); // With "populate" enabled. - function = new GetWindowFunction(); + function = new WindowsGetFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult( @@ -96,7 +96,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { // Popup. Browser* popup_browser = new Browser( Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile())); - function = new GetWindowFunction(); + function = new WindowsGetFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult( @@ -109,7 +109,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { // Panel. Browser* panel_browser = new Browser( Browser::CreateParams(Browser::TYPE_PANEL, browser()->profile())); - function = new GetWindowFunction(); + function = new WindowsGetFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult( @@ -124,7 +124,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { int incognito_window_id = ExtensionTabUtil::GetWindowId(incognito_browser); // Without "include_incognito". - function = new GetWindowFunction(); + function = new WindowsGetFunction(); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( utils::RunFunctionAndReturnError( @@ -134,7 +134,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { keys::kWindowNotFoundError)); // With "include_incognito". - function = new GetWindowFunction(); + function = new WindowsGetFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult( @@ -151,8 +151,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetCurrentWindow) { int new_id = ExtensionTabUtil::GetWindowId(new_browser); // Get the current window using new_browser. - scoped_refptr<GetCurrentWindowFunction> function = - new GetCurrentWindowFunction(); + scoped_refptr<WindowsGetCurrentFunction> function = + new WindowsGetCurrentFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( @@ -167,7 +167,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetCurrentWindow) { EXPECT_FALSE(result.get()->GetList(keys::kTabsKey, &tabs)); // Get the current window using the old window and make the tabs populated. - function = new GetCurrentWindowFunction(); + function = new WindowsGetCurrentFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -192,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetAllWindows) { window_ids.insert(ExtensionTabUtil::GetWindowId(new_browser)); } - scoped_refptr<GetAllWindowsFunction> function = new GetAllWindowsFunction(); + scoped_refptr<WindowsGetAllFunction> function = new WindowsGetAllFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); scoped_ptr<base::ListValue> result(utils::ToList( @@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetAllWindows) { EXPECT_EQ(window_ids, result_ids); result_ids.clear(); - function = new GetAllWindowsFunction(); + function = new WindowsGetAllFunction(); function->set_extension(extension.get()); result.reset(utils::ToList( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -240,7 +240,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetAllWindows) { IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, UpdateNoPermissions) { // The test empty extension has no permissions, therefore it should not get // tab data in the function result. - scoped_refptr<UpdateTabFunction> update_tab_function(new UpdateTabFunction()); + scoped_refptr<TabsUpdateFunction> update_tab_function( + new TabsUpdateFunction()); scoped_refptr<extensions::Extension> empty_extension( utils::CreateEmptyExtension()); update_tab_function->set_extension(empty_extension.get()); @@ -265,7 +266,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(), IncognitoModePrefs::FORCED); // Run without an explicit "incognito" param. - scoped_refptr<CreateWindowFunction> function(new CreateWindowFunction()); + scoped_refptr<WindowsCreateFunction> function(new WindowsCreateFunction()); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( @@ -284,7 +285,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, // Now try creating a window from incognito window. Browser* incognito_browser = CreateIncognitoBrowser(); // Run without an explicit "incognito" param. - function = new CreateWindowFunction(); + function = new WindowsCreateFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult( @@ -306,7 +307,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(), IncognitoModePrefs::FORCED); // Run without an explicit "incognito" param. - scoped_refptr<CreateWindowFunction> function = new CreateWindowFunction(); + scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( @@ -324,7 +325,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, // Now try creating a window from incognito window. Browser* incognito_browser = CreateIncognitoBrowser(); // Run without an explicit "incognito" param. - function = new CreateWindowFunction(); + function = new WindowsCreateFunction(); function->set_extension(extension.get()); result.reset(utils::ToDictionary( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -347,7 +348,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, IncognitoModePrefs::FORCED); // Run with an explicit "incognito" param. - scoped_refptr<CreateWindowFunction> function = new CreateWindowFunction(); + scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( @@ -359,7 +360,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, // Now try opening a normal window from incognito window. Browser* incognito_browser = CreateIncognitoBrowser(); // Run with an explicit "incognito" param. - function = new CreateWindowFunction(); + function = new WindowsCreateFunction(); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( utils::RunFunctionAndReturnError(function.get(), @@ -378,7 +379,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(), IncognitoModePrefs::DISABLED); // Run in normal window. - scoped_refptr<CreateWindowFunction> function = new CreateWindowFunction(); + scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( @@ -388,7 +389,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, keys::kIncognitoModeIsDisabled)); // Run in incognito window. - function = new CreateWindowFunction(); + function = new WindowsCreateFunction(); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( utils::RunFunctionAndReturnError(function.get(), @@ -407,7 +408,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) { int window_id = ExtensionTabUtil::GetWindowId(browser()); // Get tabs in the 'current' window called from non-focused browser. - scoped_refptr<QueryTabsFunction> function = new QueryTabsFunction(); + scoped_refptr<TabsQueryFunction> function = new TabsQueryFunction(); function->set_extension(utils::CreateEmptyExtension().get()); scoped_ptr<base::ListValue> result(utils::ToList( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -424,7 +425,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, QueryCurrentWindowTabs) { } // Get tabs NOT in the 'current' window called from non-focused browser. - function = new QueryTabsFunction(); + function = new TabsQueryFunction(); function->set_extension(utils::CreateEmptyExtension().get()); result.reset(utils::ToList( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -450,7 +451,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DontCreateTabInClosingPopupWindow) { int window_id = ExtensionTabUtil::GetWindowId(popup_browser); chrome::CloseWindow(popup_browser); - scoped_refptr<CreateTabFunction> create_tab_function(new CreateTabFunction()); + scoped_refptr<TabsCreateFunction> create_tab_function( + new TabsCreateFunction()); create_tab_function->set_extension(utils::CreateEmptyExtension().get()); // Without a callback the function will not generate a result. create_tab_function->set_has_callback(true); @@ -472,7 +474,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { static const char kArgsMinimizedWithFocus[] = "[%u, {\"state\": \"minimized\", \"focused\": true}]"; - scoped_refptr<UpdateWindowFunction> function = new UpdateWindowFunction(); + scoped_refptr<WindowsUpdateFunction> function = new WindowsUpdateFunction(); scoped_refptr<extensions::Extension> extension(utils::CreateEmptyExtension()); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( @@ -484,7 +486,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { static const char kArgsMaximizedWithoutFocus[] = "[%u, {\"state\": \"maximized\", \"focused\": false}]"; - function = new UpdateWindowFunction(); + function = new WindowsUpdateFunction(); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( utils::RunFunctionAndReturnError( @@ -495,7 +497,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { static const char kArgsMinimizedWithBounds[] = "[%u, {\"state\": \"minimized\", \"width\": 500}]"; - function = new UpdateWindowFunction(); + function = new WindowsUpdateFunction(); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( utils::RunFunctionAndReturnError( @@ -506,7 +508,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { static const char kArgsMaximizedWithBounds[] = "[%u, {\"state\": \"maximized\", \"width\": 500}]"; - function = new UpdateWindowFunction(); + function = new WindowsUpdateFunction(); function->set_extension(extension.get()); EXPECT_TRUE(MatchPattern( utils::RunFunctionAndReturnError( @@ -529,8 +531,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTab) { TabStripModel* tab_strip; ExtensionTabUtil::GetTabStripModel(web_contents, &tab_strip, &tab_index); - scoped_refptr<DuplicateTabFunction> duplicate_tab_function( - new DuplicateTabFunction()); + scoped_refptr<TabsDuplicateFunction> duplicate_tab_function( + new TabsDuplicateFunction()); scoped_ptr<base::DictionaryValue> test_extension_value( utils::ParseDictionary( "{\"name\": \"Test\", \"version\": \"1.0\", \"permissions\": [\"tabs\"]}" @@ -573,8 +575,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTabNoPermission) { TabStripModel* tab_strip; ExtensionTabUtil::GetTabStripModel(web_contents, &tab_strip, &tab_index); - scoped_refptr<DuplicateTabFunction> duplicate_tab_function( - new DuplicateTabFunction()); + scoped_refptr<TabsDuplicateFunction> duplicate_tab_function( + new TabsDuplicateFunction()); scoped_refptr<extensions::Extension> empty_extension( utils::CreateEmptyExtension()); duplicate_tab_function->set_extension(empty_extension.get()); 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 841a7fc..713fff5 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -19,12 +19,12 @@ #include "chrome/browser/view_type_utils.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/api/web_navigation.h" -#include "content/public/browser/resource_request_details.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/notification_service.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/resource_request_details.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" #include "net/base/net_errors.h" @@ -664,7 +664,7 @@ bool WebNavigationTabObserver::IsReferenceFragmentNavigation( url.ReplaceComponents(replacements); } -bool GetFrameFunction::RunImpl() { +bool WebNavigationGetFrameFunction::RunImpl() { scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); int tab_id = params->details.tab_id; @@ -720,7 +720,7 @@ bool GetFrameFunction::RunImpl() { return true; } -bool GetAllFramesFunction::RunImpl() { +bool WebNavigationGetAllFramesFunction::RunImpl() { scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); int tab_id = params->details.tab_id; 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 58e4308..8270307 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.h +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.h @@ -201,15 +201,15 @@ class WebNavigationEventRouter : public TabStripModelObserver, }; // API function that returns the state of a given frame. -class GetFrameFunction : public SyncExtensionFunction { - virtual ~GetFrameFunction() {} +class WebNavigationGetFrameFunction : public SyncExtensionFunction { + virtual ~WebNavigationGetFrameFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getFrame") }; // API function that returns the states of all frames in a given tab. -class GetAllFramesFunction : public SyncExtensionFunction { - virtual ~GetAllFramesFunction() {} +class WebNavigationGetAllFramesFunction : public SyncExtensionFunction { + virtual ~WebNavigationGetAllFramesFunction() {} virtual bool RunImpl() OVERRIDE; DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames") }; diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index f907d43..b53ef97 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -1706,7 +1706,7 @@ void ExtensionWebRequestEventRouter::ClearSignaled(uint64 request_id, iter->second &= ~event_type; } -// Special QuotaLimitHeuristic for WebRequestHandlerBehaviorChanged. +// Special QuotaLimitHeuristic for WebRequestHandlerBehaviorChangedFunction. // // Each call of webRequest.handlerBehaviorChanged() clears the in-memory cache // of WebKit at the time of the next page load (top level navigation event). @@ -1955,7 +1955,7 @@ bool WebRequestEventHandled::RunImpl() { return true; } -void WebRequestHandlerBehaviorChanged::GetQuotaLimitHeuristics( +void WebRequestHandlerBehaviorChangedFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { QuotaLimitHeuristic::Config config = { // See web_request.json for current value. @@ -1969,7 +1969,7 @@ void WebRequestHandlerBehaviorChanged::GetQuotaLimitHeuristics( heuristics->push_back(heuristic); } -void WebRequestHandlerBehaviorChanged::OnQuotaExceeded( +void WebRequestHandlerBehaviorChangedFunction::OnQuotaExceeded( const std::string& violation_error) { // Post warning message. ExtensionWarningSet warnings; @@ -1985,7 +1985,7 @@ void WebRequestHandlerBehaviorChanged::OnQuotaExceeded( Run(); } -bool WebRequestHandlerBehaviorChanged::RunImpl() { +bool WebRequestHandlerBehaviorChangedFunction::RunImpl() { helpers::ClearCacheOnNavigation(); return true; } diff --git a/chrome/browser/extensions/api/web_request/web_request_api.h b/chrome/browser/extensions/api/web_request/web_request_api.h index d0fb338..c7e567a 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.h +++ b/chrome/browser/extensions/api/web_request/web_request_api.h @@ -433,12 +433,13 @@ class WebRequestEventHandled : public SyncIOThreadExtensionFunction { virtual bool RunImpl() OVERRIDE; }; -class WebRequestHandlerBehaviorChanged : public SyncIOThreadExtensionFunction { +class WebRequestHandlerBehaviorChangedFunction + : public SyncIOThreadExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("webRequest.handlerBehaviorChanged"); protected: - virtual ~WebRequestHandlerBehaviorChanged() {} + virtual ~WebRequestHandlerBehaviorChangedFunction() {} // ExtensionFunction: virtual void GetQuotaLimitHeuristics( diff --git a/chrome/browser/extensions/browser_event_router.h b/chrome/browser/extensions/browser_event_router.h index 0ef7a0c..0f40c36 100644 --- a/chrome/browser/extensions/browser_event_router.h +++ b/chrome/browser/extensions/browser_event_router.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "chrome/browser/extensions/api/tabs/tabs.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_toolbar_model.h" #include "chrome/browser/ui/browser_list_observer.h" diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index b675403..d1a71f3 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -163,8 +163,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionAPIs) { } IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptPermissionsApi) { - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); - RequestPermissionsFunction::SetAutoConfirmForTests(true); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetAutoConfirmForTests(true); host_resolver()->AddRule("*.com", "127.0.0.1"); ASSERT_TRUE(StartTestServer()); ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc index a164df0..a5c645a 100644 --- a/chrome/browser/extensions/data_deleter.cc +++ b/chrome/browser/extensions/data_deleter.cc @@ -4,8 +4,8 @@ #include "chrome/browser/extensions/data_deleter.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/extension.h" #include "content/public/browser/browser_context.h" diff --git a/chrome/browser/extensions/extension_function_registry.cc b/chrome/browser/extensions/extension_function_registry.cc index 5b63968..7657dc9 100644 --- a/chrome/browser/extensions/extension_function_registry.cc +++ b/chrome/browser/extensions/extension_function_registry.cc @@ -7,44 +7,23 @@ #include "chrome/browser/accessibility/accessibility_extension_api.h" #include "chrome/browser/extensions/api/app/app_api.h" #include "chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h" -#include "chrome/browser/extensions/api/bookmarks/bookmark_api.h" #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" -#include "chrome/browser/extensions/api/cloud_print_private/cloud_print_private_api.h" #include "chrome/browser/extensions/api/commands/commands.h" -#include "chrome/browser/extensions/api/content_settings/content_settings_api.h" -#include "chrome/browser/extensions/api/context_menu/context_menu_api.h" -#include "chrome/browser/extensions/api/cookies/cookies_api.h" -#include "chrome/browser/extensions/api/debugger/debugger_api.h" -#include "chrome/browser/extensions/api/declarative/declarative_api.h" #include "chrome/browser/extensions/api/extension_action/extension_browser_actions_api.h" #include "chrome/browser/extensions/api/extension_action/extension_page_actions_api.h" #include "chrome/browser/extensions/api/extension_action/extension_script_badge_api.h" -#include "chrome/browser/extensions/api/font_settings/font_settings_api.h" -#include "chrome/browser/extensions/api/history/history_api.h" -#include "chrome/browser/extensions/api/identity/identity_api.h" -#include "chrome/browser/extensions/api/i18n/i18n_api.h" #include "chrome/browser/extensions/api/idle/idle_api.h" #include "chrome/browser/extensions/api/managed_mode/managed_mode_api.h" -#include "chrome/browser/extensions/api/management/management_api.h" #include "chrome/browser/extensions/api/metrics/metrics.h" #include "chrome/browser/extensions/api/module/module.h" #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" -#include "chrome/browser/extensions/api/page_capture/page_capture_api.h" -#include "chrome/browser/extensions/api/permissions/permissions_api.h" #include "chrome/browser/extensions/api/preference/preference_api.h" -#include "chrome/browser/extensions/api/record/record_api.h" #include "chrome/browser/extensions/api/runtime/runtime_api.h" -#include "chrome/browser/extensions/api/serial/serial_api.h" -#include "chrome/browser/extensions/api/socket/socket_api.h" -#include "chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h" -#include "chrome/browser/extensions/api/tabs/tabs.h" #include "chrome/browser/extensions/api/test/test_api.h" #include "chrome/browser/extensions/api/top_sites/top_sites_api.h" -#include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" #include "chrome/browser/extensions/api/web_request/web_request_api.h" #include "chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.h" #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" -#include "chrome/browser/extensions/settings/settings_api.h" #include "chrome/browser/extensions/system/system_api.h" #include "chrome/browser/infobars/infobar_extension_api.h" #include "chrome/browser/rlz/rlz_extension_api.h" @@ -53,18 +32,17 @@ #if defined(TOOLKIT_VIEWS) #include "chrome/browser/extensions/api/input/input.h" -#endif +#endif // defined(TOOLKIT_VIEWS) #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/extensions/echo_private_api.h" -#include "chrome/browser/chromeos/extensions/file_browser_handler_api.h" #include "chrome/browser/chromeos/extensions/info_private_api.h" #include "chrome/browser/chromeos/extensions/input_method_api.h" #include "chrome/browser/chromeos/extensions/media_player_api.h" #include "chrome/browser/chromeos/extensions/power/power_api.h" #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" #include "chrome/browser/extensions/api/terminal/terminal_private_api.h" -#endif +#endif // defined(OS_CHROMEOS) // static ExtensionFunctionRegistry* ExtensionFunctionRegistry::GetInstance() { @@ -83,33 +61,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { // Register all functions here. - // Windows - RegisterFunction<GetWindowFunction>(); - RegisterFunction<GetCurrentWindowFunction>(); - RegisterFunction<GetLastFocusedWindowFunction>(); - RegisterFunction<GetAllWindowsFunction>(); - RegisterFunction<CreateWindowFunction>(); - RegisterFunction<UpdateWindowFunction>(); - RegisterFunction<RemoveWindowFunction>(); - - // Tabs - RegisterFunction<CaptureVisibleTabFunction>(); - RegisterFunction<CreateTabFunction>(); - RegisterFunction<DetectTabLanguageFunction>(); - RegisterFunction<DuplicateTabFunction>(); - RegisterFunction<GetAllTabsInWindowFunction>(); - RegisterFunction<GetCurrentTabFunction>(); - RegisterFunction<GetSelectedTabFunction>(); - RegisterFunction<GetTabFunction>(); - RegisterFunction<HighlightTabsFunction>(); - RegisterFunction<MoveTabsFunction>(); - RegisterFunction<QueryTabsFunction>(); - RegisterFunction<ReloadTabFunction>(); - RegisterFunction<RemoveTabsFunction>(); - RegisterFunction<TabsExecuteScriptFunction>(); - RegisterFunction<TabsInsertCSSFunction>(); - RegisterFunction<UpdateTabFunction>(); - // Page Actions. RegisterFunction<EnablePageActionsFunction>(); RegisterFunction<DisablePageActionsFunction>(); @@ -154,21 +105,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<RemovePasswordsFunction>(); RegisterFunction<RemoveWebSQLFunction>(); - // Bookmarks. - RegisterFunction<extensions::GetBookmarksFunction>(); - RegisterFunction<extensions::GetBookmarkChildrenFunction>(); - RegisterFunction<extensions::GetBookmarkRecentFunction>(); - RegisterFunction<extensions::GetBookmarkTreeFunction>(); - RegisterFunction<extensions::GetBookmarkSubTreeFunction>(); - RegisterFunction<extensions::ImportBookmarksFunction>(); - RegisterFunction<extensions::ExportBookmarksFunction>(); - RegisterFunction<extensions::SearchBookmarksFunction>(); - RegisterFunction<extensions::RemoveBookmarkFunction>(); - RegisterFunction<extensions::RemoveTreeBookmarkFunction>(); - RegisterFunction<extensions::CreateBookmarkFunction>(); - RegisterFunction<extensions::MoveBookmarkFunction>(); - RegisterFunction<extensions::UpdateBookmarkFunction>(); - // Infobars. RegisterFunction<ShowInfoBarFunction>(); @@ -185,22 +121,10 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<extensions::CanEditBookmarkManagerFunction>(); RegisterFunction<extensions::CanOpenNewWindowsBookmarkFunction>(); - // History - RegisterFunction<extensions::AddUrlHistoryFunction>(); - RegisterFunction<extensions::DeleteAllHistoryFunction>(); - RegisterFunction<extensions::DeleteRangeHistoryFunction>(); - RegisterFunction<extensions::DeleteUrlHistoryFunction>(); - RegisterFunction<extensions::GetMostVisitedHistoryFunction>(); - RegisterFunction<extensions::GetVisitsHistoryFunction>(); - RegisterFunction<extensions::SearchHistoryFunction>(); - // Idle RegisterFunction<extensions::IdleQueryStateFunction>(); RegisterFunction<extensions::IdleSetDetectionIntervalFunction>(); - // I18N. - RegisterFunction<GetAcceptLanguagesFunction>(); - // Metrics. RegisterFunction<extensions::MetricsRecordUserActionFunction>(); RegisterFunction<extensions::MetricsRecordValueFunction>(); @@ -220,13 +144,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<RlzClearProductStateFunction>(); #endif - // Cookies. - RegisterFunction<extensions::GetCookieFunction>(); - RegisterFunction<extensions::GetAllCookiesFunction>(); - RegisterFunction<extensions::SetCookieFunction>(); - RegisterFunction<extensions::RemoveCookieFunction>(); - RegisterFunction<extensions::GetAllCookieStoresFunction>(); - // Test. RegisterFunction<extensions::TestNotifyPassFunction>(); RegisterFunction<extensions::TestFailFunction>(); @@ -236,10 +153,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<extensions::TestSendMessageFunction>(); RegisterFunction<extensions::TestGetConfigFunction>(); - // Record. - RegisterFunction<extensions::CaptureURLsFunction>(); - RegisterFunction<extensions::ReplayURLsFunction>(); - // Accessibility. RegisterFunction<GetFocusedControlFunction>(); RegisterFunction<SetAccessibilityEnabledFunction>(); @@ -248,12 +161,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { // Commands. RegisterFunction<GetAllCommandsFunction>(); - // Context Menus. - RegisterFunction<extensions::CreateContextMenuFunction>(); - RegisterFunction<extensions::UpdateContextMenuFunction>(); - RegisterFunction<extensions::RemoveContextMenuFunction>(); - RegisterFunction<extensions::RemoveAllContextMenusFunction>(); - // Omnibox. RegisterFunction<extensions::OmniboxSendSuggestionsFunction>(); RegisterFunction<extensions::OmniboxSetDefaultSuggestionFunction>(); @@ -282,15 +189,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<extensions::GetPolicyFunction>(); RegisterFunction<extensions::SetPolicyFunction>(); - // Management. - RegisterFunction<extensions::GetAllExtensionsFunction>(); - RegisterFunction<extensions::GetExtensionByIdFunction>(); - RegisterFunction<extensions::GetPermissionWarningsByIdFunction>(); - RegisterFunction<extensions::GetPermissionWarningsByManifestFunction>(); - RegisterFunction<extensions::LaunchAppFunction>(); - RegisterFunction<extensions::SetEnabledFunction>(); - RegisterFunction<extensions::UninstallFunction>(); - // Extension module. RegisterFunction<extensions::SetUpdateUrlDataFunction>(); RegisterFunction<extensions::IsAllowedIncognitoAccessFunction>(); @@ -305,14 +203,9 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<extensions::CompleteInstallFunction>(); RegisterFunction<extensions::GetWebGLStatusFunction>(); - // WebNavigation. - RegisterFunction<extensions::GetFrameFunction>(); - RegisterFunction<extensions::GetAllFramesFunction>(); - // WebRequest. RegisterFunction<WebRequestAddEventListener>(); RegisterFunction<WebRequestEventHandled>(); - RegisterFunction<WebRequestHandlerBehaviorChanged>(); // Preferences. RegisterFunction<extensions::GetPreferenceFunction>(); @@ -324,9 +217,6 @@ void ExtensionFunctionRegistry::ResetFunctions() { // Device Customization. RegisterFunction<extensions::GetChromeosInfoFunction>(); - // FileBrowserHandlerInternal. - RegisterFunction<FileHandlerSelectFileFunction>(); - // Mediaplayer RegisterFunction<extensions::PlayMediaplayerFunction>(); RegisterFunction<extensions::GetPlaylistMediaplayerFunction>(); @@ -362,83 +252,17 @@ void ExtensionFunctionRegistry::ResetFunctions() { extensions::WebSocketProxyPrivateGetPassportForTCPFunction>(); RegisterFunction<extensions::WebSocketProxyPrivateGetURLForTCPFunction>(); - // Debugger - RegisterFunction<AttachDebuggerFunction>(); - RegisterFunction<DetachDebuggerFunction>(); - RegisterFunction<SendCommandDebuggerFunction>(); - - // Settings - RegisterFunction<extensions::GetSettingsFunction>(); - RegisterFunction<extensions::SetSettingsFunction>(); - RegisterFunction<extensions::RemoveSettingsFunction>(); - RegisterFunction<extensions::ClearSettingsFunction>(); - RegisterFunction<extensions::GetBytesInUseSettingsFunction>(); - - // Content settings. - RegisterFunction<extensions::GetResourceIdentifiersFunction>(); - RegisterFunction<extensions::ClearContentSettingsFunction>(); - RegisterFunction<extensions::GetContentSettingFunction>(); - RegisterFunction<extensions::SetContentSettingFunction>(); - - // Font settings. - RegisterFunction<extensions::GetFontListFunction>(); - RegisterFunction<extensions::ClearFontFunction>(); - RegisterFunction<extensions::GetFontFunction>(); - RegisterFunction<extensions::SetFontFunction>(); - RegisterFunction<extensions::ClearDefaultFontSizeFunction>(); - RegisterFunction<extensions::GetDefaultFontSizeFunction>(); - RegisterFunction<extensions::SetDefaultFontSizeFunction>(); - RegisterFunction<extensions::ClearDefaultFixedFontSizeFunction>(); - RegisterFunction<extensions::GetDefaultFixedFontSizeFunction>(); - RegisterFunction<extensions::SetDefaultFixedFontSizeFunction>(); - RegisterFunction<extensions::ClearMinimumFontSizeFunction>(); - RegisterFunction<extensions::GetMinimumFontSizeFunction>(); - RegisterFunction<extensions::SetMinimumFontSizeFunction>(); - - // CloudPrint settings. - RegisterFunction<extensions::CloudPrintSetupConnectorFunction>(); - RegisterFunction<extensions::CloudPrintGetHostNameFunction>(); - RegisterFunction<extensions::CloudPrintGetPrintersFunction>(); - // Experimental App API. RegisterFunction<extensions::AppNotifyFunction>(); RegisterFunction<extensions::AppClearAllNotificationsFunction>(); - // Permissions - RegisterFunction<ContainsPermissionsFunction>(); - RegisterFunction<GetAllPermissionsFunction>(); - RegisterFunction<RemovePermissionsFunction>(); - RegisterFunction<RequestPermissionsFunction>(); - - // PageCapture - RegisterFunction<extensions::PageCaptureSaveAsMHTMLFunction>(); - // TopSites RegisterFunction<extensions::GetTopSitesFunction>(); - // Serial - RegisterFunction<extensions::SerialOpenFunction>(); - RegisterFunction<extensions::SerialCloseFunction>(); - RegisterFunction<extensions::SerialReadFunction>(); - RegisterFunction<extensions::SerialWriteFunction>(); - - // Sockets - RegisterFunction<extensions::SocketCreateFunction>(); - RegisterFunction<extensions::SocketDestroyFunction>(); - RegisterFunction<extensions::SocketConnectFunction>(); - RegisterFunction<extensions::SocketDisconnectFunction>(); - RegisterFunction<extensions::SocketReadFunction>(); - RegisterFunction<extensions::SocketWriteFunction>(); - // System RegisterFunction<extensions::GetIncognitoModeAvailabilityFunction>(); RegisterFunction<extensions::GetUpdateStatusFunction>(); - // Net - RegisterFunction<extensions::AddRulesFunction>(); - RegisterFunction<extensions::RemoveRulesFunction>(); - RegisterFunction<extensions::GetRulesFunction>(); - // Runtime RegisterFunction<extensions::RuntimeGetBackgroundPageFunction>(); RegisterFunction<extensions::RuntimeReloadFunction>(); diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 4917d5f..726959e 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -36,6 +36,7 @@ #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h" #include "chrome/browser/extensions/api/runtime/runtime_api.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include "chrome/browser/extensions/app_notification_manager.h" #include "chrome/browser/extensions/app_sync_data.h" #include "chrome/browser/extensions/browser_event_router.h" @@ -62,7 +63,6 @@ #include "chrome/browser/extensions/pending_extension_manager.h" #include "chrome/browser/extensions/permissions_updater.h" #include "chrome/browser/extensions/platform_app_launcher.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" #include "chrome/browser/extensions/shell_window_registry.h" #include "chrome/browser/extensions/unpacked_installer.h" #include "chrome/browser/extensions/updater/extension_updater.h" diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index d2715bd..718d2bd 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -10,8 +10,8 @@ #include "chrome/browser/automation/automation_util.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/extensions/api/permissions/permissions_api.h" -#include "chrome/browser/extensions/app_restore_service_factory.h" #include "chrome/browser/extensions/app_restore_service.h" +#include "chrome/browser/extensions/app_restore_service_factory.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_service.h" @@ -761,7 +761,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppDevToolsBrowserTest, ReOpenedWithURL) { #endif IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) { - RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); + PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); const Extension* extension = LoadAndLaunchPlatformApp("optional_permission_request"); ASSERT_TRUE(extension) << "Failed to load extension."; diff --git a/chrome/browser/extensions/platform_app_browsertest_util.cc b/chrome/browser/extensions/platform_app_browsertest_util.cc index 4611c0a..f1b78a4 100644 --- a/chrome/browser/extensions/platform_app_browsertest_util.cc +++ b/chrome/browser/extensions/platform_app_browsertest_util.cc @@ -6,7 +6,7 @@ #include "base/command_line.h" #include "base/stringprintf.h" -#include "chrome/browser/extensions/api/tabs/tabs.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/shell_window_registry.h" #include "chrome/browser/ui/browser.h" @@ -93,7 +93,7 @@ ShellWindow* PlatformAppBrowserTest::GetFirstShellWindow() { size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( const Extension* extension) { - scoped_refptr<GetAllWindowsFunction> function = new GetAllWindowsFunction(); + scoped_refptr<WindowsGetAllFunction> function = new WindowsGetAllFunction(); function->set_extension(extension); scoped_ptr<base::ListValue> result(utils::ToList( utils::RunFunctionAndReturnSingleResult(function.get(), @@ -105,7 +105,7 @@ size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( int window_id, const Extension* extension) { - scoped_refptr<GetWindowFunction> function = new GetWindowFunction(); + scoped_refptr<WindowsGetFunction> function = new WindowsGetFunction(); function->set_extension(extension); utils::RunFunction( function.get(), diff --git a/chrome/browser/performance_monitor/performance_monitor.gyp b/chrome/browser/performance_monitor/performance_monitor.gyp index 08fe90e..e3587f4 100644 --- a/chrome/browser/performance_monitor/performance_monitor.gyp +++ b/chrome/browser/performance_monitor/performance_monitor.gyp @@ -8,14 +8,14 @@ 'target_name': 'performance_monitor', 'type': 'static_library', 'sources': [ - '<@(json_schema_files)', + '<@(schema_files)', ], 'includes': [ '../../../build/json_schema_compile.gypi', ], 'variables': { 'chromium_code': 1, - 'json_schema_files': [ + 'schema_files': [ 'events.json', ], 'cc_dir': 'chrome/browser/performance_monitor', diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index ff03982..c888a88 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -17,7 +17,7 @@ #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/extensions/api/commands/command_service.h" -#include "chrome/browser/extensions/api/tabs/tabs.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/component_loader.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_web_ui.h" @@ -278,7 +278,7 @@ void RegisterUserPrefs(PrefServiceSyncable* user_prefs) { #endif #if !defined(OS_ANDROID) - CaptureVisibleTabFunction::RegisterUserPrefs(user_prefs); + TabsCaptureVisibleTabFunction::RegisterUserPrefs(user_prefs); ChromeToMobileService::RegisterUserPrefs(user_prefs); DevToolsWindow::RegisterUserPrefs(user_prefs); extensions::CommandService::RegisterUserPrefs(user_prefs); diff --git a/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc b/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc index 1c6d472..7518a83 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc @@ -5,7 +5,7 @@ #include "chrome/browser/sync/glue/chrome_extensions_activity_monitor.h" #include "base/bind.h" -#include "chrome/browser/extensions/api/bookmarks/bookmark_api.h" +#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc index f03e231..37ddfd6 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc @@ -8,7 +8,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/values.h" -#include "chrome/browser/extensions/api/bookmarks/bookmark_api.h" +#include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" @@ -86,18 +86,20 @@ class SyncChromeExtensionsActivityMonitorTest : public testing::Test { // 2. Only the mutating events should be recorded by the // syncer::ExtensionsActivityMonitor. TEST_F(SyncChromeExtensionsActivityMonitorTest, Basic) { - FireBookmarksApiEvent<extensions::RemoveBookmarkFunction>(extension1_, 1); - FireBookmarksApiEvent<extensions::MoveBookmarkFunction>(extension1_, 1); - FireBookmarksApiEvent<extensions::UpdateBookmarkFunction>(extension1_, 2); - FireBookmarksApiEvent<extensions::CreateBookmarkFunction>(extension1_, 3); - FireBookmarksApiEvent<extensions::SearchBookmarksFunction>(extension1_, 5); + FireBookmarksApiEvent<extensions::BookmarksRemoveFunction>(extension1_, 1); + FireBookmarksApiEvent<extensions::BookmarksMoveFunction>(extension1_, 1); + FireBookmarksApiEvent<extensions::BookmarksUpdateFunction>(extension1_, 2); + FireBookmarksApiEvent<extensions::BookmarksCreateFunction>(extension1_, 3); + FireBookmarksApiEvent<extensions::BookmarksSearchFunction>(extension1_, 5); const uint32 writes_by_extension1 = 1 + 1 + 2 + 3; - FireBookmarksApiEvent<extensions::RemoveTreeBookmarkFunction>(extension2_, 8); - FireBookmarksApiEvent<extensions::GetBookmarkTreeFunction>(extension2_, 13); - FireBookmarksApiEvent<extensions::GetBookmarkChildrenFunction>( + FireBookmarksApiEvent<extensions::BookmarksRemoveTreeFunction>( + extension2_, 8); + FireBookmarksApiEvent<extensions::BookmarksGetSubTreeFunction>( + extension2_, 13); + FireBookmarksApiEvent<extensions::BookmarksGetChildrenFunction>( extension2_, 21); - FireBookmarksApiEvent<extensions::GetBookmarksFunction>(extension2_, 33); + FireBookmarksApiEvent<extensions::BookmarksGetTreeFunction>(extension2_, 33); const uint32 writes_by_extension2 = 8; syncer::ExtensionsActivityMonitor::Records results; @@ -115,8 +117,8 @@ TEST_F(SyncChromeExtensionsActivityMonitorTest, Basic) { // and put the old records back. Those should be merged with the new // records correctly. TEST_F(SyncChromeExtensionsActivityMonitorTest, Put) { - FireBookmarksApiEvent<extensions::CreateBookmarkFunction>(extension1_, 5); - FireBookmarksApiEvent<extensions::MoveBookmarkFunction>(extension2_, 8); + FireBookmarksApiEvent<extensions::BookmarksCreateFunction>(extension1_, 5); + FireBookmarksApiEvent<extensions::BookmarksMoveFunction>(extension2_, 8); syncer::ExtensionsActivityMonitor::Records results; monitor_.GetAndClearRecords(&results); @@ -125,8 +127,8 @@ TEST_F(SyncChromeExtensionsActivityMonitorTest, Put) { EXPECT_EQ(5U, results[id1_].bookmark_write_count); EXPECT_EQ(8U, results[id2_].bookmark_write_count); - FireBookmarksApiEvent<extensions::GetBookmarksFunction>(extension2_, 3); - FireBookmarksApiEvent<extensions::UpdateBookmarkFunction>(extension2_, 2); + FireBookmarksApiEvent<extensions::BookmarksGetTreeFunction>(extension2_, 3); + FireBookmarksApiEvent<extensions::BookmarksUpdateFunction>(extension2_, 2); // Simulate a commit failure, which augments the active record set with the // refugee records. @@ -145,7 +147,7 @@ TEST_F(SyncChromeExtensionsActivityMonitorTest, Put) { // times. The mintor should correctly clear its records every time // they're returned. TEST_F(SyncChromeExtensionsActivityMonitorTest, MultiGet) { - FireBookmarksApiEvent<extensions::CreateBookmarkFunction>(extension1_, 5); + FireBookmarksApiEvent<extensions::BookmarksCreateFunction>(extension1_, 5); syncer::ExtensionsActivityMonitor::Records results; monitor_.GetAndClearRecords(&results); @@ -156,7 +158,7 @@ TEST_F(SyncChromeExtensionsActivityMonitorTest, MultiGet) { monitor_.GetAndClearRecords(&results); EXPECT_TRUE(results.empty()); - FireBookmarksApiEvent<extensions::CreateBookmarkFunction>(extension1_, 3); + FireBookmarksApiEvent<extensions::BookmarksCreateFunction>(extension1_, 3); monitor_.GetAndClearRecords(&results); EXPECT_EQ(1U, results.size()); diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index a9d9a52..acdefba 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -5,11 +5,11 @@ #include "base/command_line.h" #include "build/build_config.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include "chrome/browser/extensions/app_notification_manager.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/extensions/extension_system_factory.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/prefs/pref_model_associator.h" @@ -46,8 +46,8 @@ #include "chrome/browser/sync/glue/ui_data_type_controller.h" #include "chrome/browser/sync/profile_sync_components_factory_impl.h" #include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/themes/theme_syncable_service.h" #include "chrome/browser/webdata/autocomplete_syncable_service.h" #include "chrome/browser/webdata/autofill_profile_syncable_service.h" diff --git a/chrome/browser/sync/test/integration/extension_settings_helper.cc b/chrome/browser/sync/test/integration/extension_settings_helper.cc index 5c42b95..be57a4a 100644 --- a/chrome/browser/sync/test/integration/extension_settings_helper.cc +++ b/chrome/browser/sync/test/integration/extension_settings_helper.cc @@ -6,12 +6,12 @@ #include "base/bind.h" #include "base/json/json_writer.h" -#include "base/memory/scoped_ptr.h" #include "base/logging.h" +#include "base/memory/scoped_ptr.h" #include "base/synchronization/waitable_event.h" #include "base/values.h" +#include "chrome/browser/extensions/api/storage/settings_frontend.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/settings/settings_frontend.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/test/integration/extensions_helper.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index 97894ed..ebdaa95 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -17,7 +17,7 @@ #include "chrome/browser/command_updater.h" #include "chrome/browser/defaults.h" #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" -#include "chrome/browser/extensions/api/tabs/tabs.h" +#include "chrome/browser/extensions/api/tabs/tabs_api.h" #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/location_bar_controller.h" #include "chrome/browser/extensions/tab_helper.h" diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 97b6e33..1765329 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -97,14 +97,14 @@ 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_constants.cc', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api_constants.h', - 'browser/extensions/api/bookmarks/bookmark_api.cc', - 'browser/extensions/api/bookmarks/bookmark_api.h', 'browser/extensions/api/bookmarks/bookmark_api_constants.cc', 'browser/extensions/api/bookmarks/bookmark_api_constants.h', 'browser/extensions/api/bookmarks/bookmark_api_factory.cc', 'browser/extensions/api/bookmarks/bookmark_api_factory.h', 'browser/extensions/api/bookmarks/bookmark_api_helpers.cc', 'browser/extensions/api/bookmarks/bookmark_api_helpers.h', + 'browser/extensions/api/bookmarks/bookmarks_api.cc', + 'browser/extensions/api/bookmarks/bookmarks_api.h', 'browser/extensions/api/browsing_data/browsing_data_api.cc', 'browser/extensions/api/browsing_data/browsing_data_api.h', 'browser/extensions/api/cloud_print_private/cloud_print_private_api.cc', @@ -123,8 +123,8 @@ 'browser/extensions/api/content_settings/content_settings_store.h', 'browser/extensions/api/commands/commands.cc', 'browser/extensions/api/commands/commands.h', - 'browser/extensions/api/context_menu/context_menu_api.cc', - 'browser/extensions/api/context_menu/context_menu_api.h', + 'browser/extensions/api/context_menus/context_menus_api.cc', + 'browser/extensions/api/context_menus/context_menus_api.h', 'browser/extensions/api/cookies/cookies_api.cc', 'browser/extensions/api/cookies/cookies_api.h', 'browser/extensions/api/cookies/cookies_api_constants.cc', @@ -324,6 +324,38 @@ 'browser/extensions/api/socket/tcp_socket.h', 'browser/extensions/api/socket/udp_socket.cc', 'browser/extensions/api/socket/udp_socket.h', + 'browser/extensions/api/storage/leveldb_settings_storage_factory.cc', + 'browser/extensions/api/storage/leveldb_settings_storage_factory.h', + 'browser/extensions/api/storage/managed_value_store_cache.cc', + 'browser/extensions/api/storage/managed_value_store_cache.h', + 'browser/extensions/api/storage/policy_value_store.cc', + 'browser/extensions/api/storage/policy_value_store.h', + 'browser/extensions/api/storage/setting_sync_data.cc', + 'browser/extensions/api/storage/setting_sync_data.h', + 'browser/extensions/api/storage/settings_backend.cc', + 'browser/extensions/api/storage/settings_backend.h', + 'browser/extensions/api/storage/settings_frontend.cc', + 'browser/extensions/api/storage/settings_frontend.h', + 'browser/extensions/api/storage/settings_namespace.cc', + 'browser/extensions/api/storage/settings_namespace.h', + 'browser/extensions/api/storage/settings_observer.h', + 'browser/extensions/api/storage/settings_storage_factory.h', + 'browser/extensions/api/storage/settings_storage_quota_enforcer.cc', + 'browser/extensions/api/storage/settings_storage_quota_enforcer.h', + 'browser/extensions/api/storage/settings_sync_processor.cc', + 'browser/extensions/api/storage/settings_sync_processor.h', + 'browser/extensions/api/storage/settings_sync_util.cc', + 'browser/extensions/api/storage/settings_sync_util.h', + 'browser/extensions/api/storage/storage_api.cc', + 'browser/extensions/api/storage/storage_api.h', + 'browser/extensions/api/storage/sync_or_local_value_store_cache.cc', + 'browser/extensions/api/storage/sync_or_local_value_store_cache.h', + 'browser/extensions/api/storage/syncable_settings_storage.cc', + 'browser/extensions/api/storage/syncable_settings_storage.h', + 'browser/extensions/api/storage/value_store_cache.cc', + 'browser/extensions/api/storage/value_store_cache.h', + 'browser/extensions/api/storage/weak_unlimited_settings_storage.cc', + 'browser/extensions/api/storage/weak_unlimited_settings_storage.h', 'browser/extensions/api/sync_file_system/extension_sync_event_observer_factory.cc', 'browser/extensions/api/sync_file_system/extension_sync_event_observer_factory.h', 'browser/extensions/api/sync_file_system/extension_sync_event_observer.cc', @@ -367,10 +399,8 @@ 'browser/extensions/api/tab_capture/tab_capture_registry.h', 'browser/extensions/api/tab_capture/tab_capture_registry_factory.cc', 'browser/extensions/api/tab_capture/tab_capture_registry_factory.h', - 'browser/extensions/api/tabs/execute_code_in_tab_function.cc', - 'browser/extensions/api/tabs/execute_code_in_tab_function.h', - 'browser/extensions/api/tabs/tabs.cc', - 'browser/extensions/api/tabs/tabs.h', + 'browser/extensions/api/tabs/tabs_api.cc', + 'browser/extensions/api/tabs/tabs_api.h', 'browser/extensions/api/tabs/tabs_windows_api.cc', 'browser/extensions/api/tabs/tabs_windows_api.h', 'browser/extensions/api/tabs/tabs_constants.cc', @@ -636,38 +666,6 @@ 'browser/extensions/script_bubble_controller.h', 'browser/extensions/script_executor.cc', 'browser/extensions/script_executor.h', - 'browser/extensions/settings/leveldb_settings_storage_factory.cc', - 'browser/extensions/settings/leveldb_settings_storage_factory.h', - 'browser/extensions/settings/managed_value_store_cache.cc', - 'browser/extensions/settings/managed_value_store_cache.h', - 'browser/extensions/settings/policy_value_store.cc', - 'browser/extensions/settings/policy_value_store.h', - 'browser/extensions/settings/setting_sync_data.cc', - 'browser/extensions/settings/setting_sync_data.h', - 'browser/extensions/settings/settings_api.cc', - 'browser/extensions/settings/settings_api.h', - 'browser/extensions/settings/settings_backend.cc', - 'browser/extensions/settings/settings_backend.h', - 'browser/extensions/settings/settings_frontend.cc', - 'browser/extensions/settings/settings_frontend.h', - 'browser/extensions/settings/settings_namespace.cc', - 'browser/extensions/settings/settings_namespace.h', - 'browser/extensions/settings/settings_observer.h', - 'browser/extensions/settings/settings_storage_factory.h', - 'browser/extensions/settings/settings_storage_quota_enforcer.cc', - 'browser/extensions/settings/settings_storage_quota_enforcer.h', - 'browser/extensions/settings/settings_sync_processor.cc', - 'browser/extensions/settings/settings_sync_processor.h', - 'browser/extensions/settings/settings_sync_util.cc', - 'browser/extensions/settings/settings_sync_util.h', - 'browser/extensions/settings/sync_or_local_value_store_cache.cc', - 'browser/extensions/settings/sync_or_local_value_store_cache.h', - 'browser/extensions/settings/syncable_settings_storage.cc', - 'browser/extensions/settings/syncable_settings_storage.h', - 'browser/extensions/settings/value_store_cache.cc', - 'browser/extensions/settings/value_store_cache.h', - 'browser/extensions/settings/weak_unlimited_settings_storage.cc', - 'browser/extensions/settings/weak_unlimited_settings_storage.h', 'browser/extensions/shell_window_geometry_cache.cc', 'browser/extensions/shell_window_geometry_cache.h', 'browser/extensions/shell_window_registry.cc', @@ -786,6 +784,7 @@ ['include', '^browser/extensions/api/proxy/proxy_api_constants.cc'], ['include', '^browser/extensions/api/push_messaging/push_messaging_api.cc'], ['include', '^browser/extensions/api/runtime/runtime_api.cc'], + ['include', '^browser/extensions/api/storage/.*\.cc'], ['include', '^browser/extensions/api/system_info_cpu/cpu_info_provider.cc'], ['include', '^browser/extensions/api/system_info_cpu/cpu_info_provider_android.cc'], ['include', '^browser/extensions/api/tabs/tabs_constants.cc'], @@ -832,10 +831,10 @@ ], }, { # configuration_policy==0 'sources!': [ - 'browser/extensions/settings/managed_value_store_cache.cc', - 'browser/extensions/settings/managed_value_store_cache.h', - 'browser/extensions/settings/policy_value_store.cc', - 'browser/extensions/settings/policy_value_store.h', + 'browser/extensions/api/storage/managed_value_store_cache.cc', + 'browser/extensions/api/storage/managed_value_store_cache.h', + 'browser/extensions/api/storage/policy_value_store.cc', + 'browser/extensions/api/storage/policy_value_store.h', ], }], ['OS=="win"', { diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index ad69e62..7449b3e 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -969,7 +969,7 @@ 'browser/extensions/api/browsing_data/browsing_data_test.cc', 'browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc', 'browser/extensions/api/content_settings/content_settings_apitest.cc', - 'browser/extensions/api/context_menu/context_menu_apitest.cc', + 'browser/extensions/api/context_menus/context_menu_apitest.cc', 'browser/extensions/api/cookies/cookies_apitest.cc', 'browser/extensions/api/debugger/debugger_apitest.cc', 'browser/extensions/api/declarative/declarative_apitest.cc', @@ -1088,7 +1088,7 @@ 'browser/extensions/process_management_browsertest.cc', 'browser/extensions/requirements_checker_browsertest.cc', 'browser/extensions/sandboxed_pages_apitest.cc', - 'browser/extensions/settings/settings_apitest.cc', + 'browser/extensions/api/storage/settings_apitest.cc', 'browser/extensions/stubs_apitest.cc', 'browser/extensions/subscribe_page_action_browsertest.cc', 'browser/extensions/system/system_apitest.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index c1fb539..dd10e5c 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -735,12 +735,12 @@ 'browser/extensions/sandboxed_unpacker_unittest.cc', 'browser/extensions/script_badge_controller_unittest.cc', 'browser/extensions/script_bubble_controller_unittest.cc', - 'browser/extensions/settings/policy_value_store_unittest.cc', - 'browser/extensions/settings/settings_frontend_unittest.cc', - 'browser/extensions/settings/settings_quota_unittest.cc', - 'browser/extensions/settings/settings_sync_unittest.cc', - 'browser/extensions/settings/settings_test_util.cc', - 'browser/extensions/settings/settings_test_util.h', + 'browser/extensions/api/storage/policy_value_store_unittest.cc', + 'browser/extensions/api/storage/settings_frontend_unittest.cc', + 'browser/extensions/api/storage/settings_quota_unittest.cc', + 'browser/extensions/api/storage/settings_sync_unittest.cc', + 'browser/extensions/api/storage/settings_test_util.cc', + 'browser/extensions/api/storage/settings_test_util.h', 'browser/extensions/shell_window_geometry_cache_unittest.cc', 'browser/extensions/standard_management_policy_provider_unittest.cc', 'browser/extensions/updater/extension_updater_unittest.cc', @@ -1789,7 +1789,7 @@ }], ['configuration_policy==0', { 'sources!': [ - 'browser/extensions/settings/policy_value_store_unittest.cc', + 'browser/extensions/api/storage/policy_value_store_unittest.cc', 'browser/managed_mode/managed_mode_url_filter_unittest.cc', 'browser/prefs/proxy_policy_unittest.cc', 'browser/ui/webui/policy_ui_unittest.cc', diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp index 95af0dc..fce4407 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -8,8 +8,7 @@ 'target_name': 'api', 'type': 'static_library', 'sources': [ - '<@(idl_schema_files)', - '<@(json_schema_files)', + '<@(schema_files)', ], 'includes': [ '../../../../build/json_schema_bundle_compile.gypi', @@ -17,75 +16,71 @@ ], 'variables': { 'chromium_code': 1, - 'json_schema_files': [ - 'bookmarks.json', - 'cloud_print_private.json', - 'content_settings.json', - 'context_menus.json', - 'cookies.json', - 'debugger.json', - 'events.json', - 'experimental_history.json', - 'experimental_record.json', - 'file_browser_handler_internal.json', - 'i18n.json', - 'font_settings.json', - 'history.json', - 'management.json', - 'page_capture.json', - 'permissions.json', - 'storage.json', - 'tabs.json', - 'web_navigation.json', - 'web_request.json', - 'windows.json', - ], - 'idl_schema_files': [ + 'schema_files': [ 'alarms.idl', 'app_current_window_internal.idl', 'app_runtime.idl', 'app_window.idl', 'autotest_private.idl', 'bluetooth.idl', + 'bookmarks.json', + 'cloud_print_private.json', + 'content_settings.json', + 'context_menus.json', + 'cookies.json', + 'debugger.json', 'developer_private.idl', 'dial.idl', 'downloads.idl', + 'events.json', 'experimental_discovery.idl', 'experimental_dns.idl', + 'experimental_history.json', 'experimental_identity.idl', 'experimental_idltest.idl', 'experimental_media_galleries.idl', 'experimental_notification.idl', + 'experimental_record.json', 'experimental_system_info_cpu.idl', 'experimental_system_info_display.idl', 'experimental_system_info_memory.idl', 'experimental_system_info_storage.idl', + 'file_browser_handler_internal.json', 'file_system.idl', + 'font_settings.json', + 'history.json', + 'i18n.json', + 'management.json', 'media_galleries.idl', 'media_galleries_private.idl', + 'page_capture.json', + 'permissions.json', 'push_messaging.idl', 'rtc_private.idl', 'serial.idl', 'socket.idl', + 'storage.json', 'sync_file_system.idl', 'system_indicator.idl', 'tab_capture.idl', + 'tabs.json', 'usb.idl', + 'web_navigation.json', + 'web_request.json', + 'windows.json', ], 'cc_dir': 'chrome/common/extensions/api', 'root_namespace': 'extensions::api', }, 'conditions': [ ['OS=="android"', { - 'idl_schema_files!': [ + 'schema_files!': [ 'usb.idl', ], }], ['OS!="chromeos"', { - 'json_schema_files!': [ + 'schema_files!': [ 'file_browser_handler_internal.json', - ], - 'idl_schema_files!': [ 'rtc_private.idl', ], }], diff --git a/chrome/common/extensions/api/content_settings.json b/chrome/common/extensions/api/content_settings.json index 3c04bac..43643dd 100644 --- a/chrome/common/extensions/api/content_settings.json +++ b/chrome/common/extensions/api/content_settings.json @@ -5,6 +5,9 @@ [ { "namespace": "contentSettings", + "compiler_options": { + "generate_type_functions": true + }, "types": [ { "id": "ResourceIdentifier", diff --git a/chrome/common/extensions/api/events.json b/chrome/common/extensions/api/events.json index cacc8dc..b003fb6 100644 --- a/chrome/common/extensions/api/events.json +++ b/chrome/common/extensions/api/events.json @@ -5,6 +5,10 @@ [ { "namespace": "events", + "compiler_options": { + "implemented_in": "chrome/browser/extensions/api/declarative/declarative_api.h", + "generate_type_functions": true + }, "internal": true, "unprivileged": true, "types": [ diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc index fc38a24..85207e7 100644 --- a/chrome/common/extensions/api/extension_api.cc +++ b/chrome/common/extensions/api/extension_api.cc @@ -344,8 +344,6 @@ void ExtensionAPI::InitDefaultConfiguration() { CHECK(unloaded_schemas_.empty()); RegisterSchema("app", ReadFromResource( IDR_EXTENSION_API_JSON_APP)); - RegisterSchema("bookmarks", ReadFromResource( - IDR_EXTENSION_API_JSON_BOOKMARKS)); RegisterSchema("bookmarkManagerPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_BOOKMARKMANAGERPRIVATE)); RegisterSchema("browserAction", ReadFromResource( @@ -354,30 +352,16 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_BROWSINGDATA)); RegisterSchema("chromeosInfoPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_CHROMEOSINFOPRIVATE)); - RegisterSchema("cloudPrintPrivate", ReadFromResource( - IDR_EXTENSION_API_JSON_CLOUDPRINTPRIVATE)); RegisterSchema("commands", ReadFromResource( IDR_EXTENSION_API_JSON_COMMANDS)); - RegisterSchema("contentSettings", ReadFromResource( - IDR_EXTENSION_API_JSON_CONTENTSETTINGS)); - RegisterSchema("contextMenus", ReadFromResource( - IDR_EXTENSION_API_JSON_CONTEXTMENUS)); - RegisterSchema("cookies", ReadFromResource( - IDR_EXTENSION_API_JSON_COOKIES)); - RegisterSchema("debugger", ReadFromResource( - IDR_EXTENSION_API_JSON_DEBUGGER)); RegisterSchema("declarativeWebRequest", ReadFromResource( IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST)); RegisterSchema("devtools", ReadFromResource( IDR_EXTENSION_API_JSON_DEVTOOLS)); - RegisterSchema("events", ReadFromResource( - IDR_EXTENSION_API_JSON_EVENTS)); RegisterSchema("experimental.accessibility", ReadFromResource( IDR_EXTENSION_API_JSON_EXPERIMENTAL_ACCESSIBILITY)); RegisterSchema("experimental.app", ReadFromResource( IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP)); - RegisterSchema("experimental.history", ReadFromResource( - IDR_EXTENSION_API_JSON_EXPERIMENTAL_HISTORY)); RegisterSchema("experimental.infobars", ReadFromResource( IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS)); RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource( @@ -386,8 +370,6 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_EXPERIMENTAL_POWER)); RegisterSchema("experimental.processes", ReadFromResource( IDR_EXTENSION_API_JSON_EXPERIMENTAL_PROCESSES)); - RegisterSchema("experimental.record", ReadFromResource( - IDR_EXTENSION_API_JSON_EXPERIMENTAL_RECORD)); RegisterSchema("experimental.rlz", ReadFromResource( IDR_EXTENSION_API_JSON_EXPERIMENTAL_RLZ)); RegisterSchema("runtime", ReadFromResource( @@ -398,16 +380,8 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_EXTENSION)); RegisterSchema("fileBrowserHandler", ReadFromResource( IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER)); - RegisterSchema("fileBrowserHandlerInternal", ReadFromResource( - IDR_EXTENSION_API_JSON_FILEBROWSERHANDLERINTERNAL)); RegisterSchema("fileBrowserPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_FILEBROWSERPRIVATE)); - RegisterSchema("fontSettings", ReadFromResource( - IDR_EXTENSION_API_JSON_FONTSSETTINGS)); - RegisterSchema("history", ReadFromResource( - IDR_EXTENSION_API_JSON_HISTORY)); - RegisterSchema("i18n", ReadFromResource( - IDR_EXTENSION_API_JSON_I18N)); RegisterSchema("idle", ReadFromResource( IDR_EXTENSION_API_JSON_IDLE)); RegisterSchema("input.ime", ReadFromResource( @@ -416,8 +390,6 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE)); RegisterSchema("managedModePrivate", ReadFromResource( IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE)); - RegisterSchema("management", ReadFromResource( - IDR_EXTENSION_API_JSON_MANAGEMENT)); RegisterSchema("mediaPlayerPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_MEDIAPLAYERPRIVATE)); RegisterSchema("metricsPrivate", ReadFromResource( @@ -430,8 +402,6 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_PAGEACTION)); RegisterSchema("pageActions", ReadFromResource( IDR_EXTENSION_API_JSON_PAGEACTIONS)); - RegisterSchema("pageCapture", ReadFromResource( - IDR_EXTENSION_API_JSON_PAGECAPTURE)); RegisterSchema("permissions", ReadFromResource( IDR_EXTENSION_API_JSON_PERMISSIONS)); RegisterSchema("privacy", ReadFromResource( @@ -440,12 +410,8 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_PROXY)); RegisterSchema("scriptBadge", ReadFromResource( IDR_EXTENSION_API_JSON_SCRIPTBADGE)); - RegisterSchema("storage", ReadFromResource( - IDR_EXTENSION_API_JSON_STORAGE)); RegisterSchema("systemPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_SYSTEMPRIVATE)); - RegisterSchema("tabs", ReadFromResource( - IDR_EXTENSION_API_JSON_TABS)); RegisterSchema("terminalPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_TERMINALPRIVATE)); RegisterSchema("test", ReadFromResource( @@ -460,10 +426,6 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_TYPES)); RegisterSchema("wallpaperPrivate", ReadFromResource( IDR_EXTENSION_API_JSON_WALLPAPERPRIVATE)); - RegisterSchema("webNavigation", ReadFromResource( - IDR_EXTENSION_API_JSON_WEBNAVIGATION)); - RegisterSchema("webRequest", ReadFromResource( - IDR_EXTENSION_API_JSON_WEBREQUEST)); RegisterSchema("webRequestInternal", ReadFromResource( IDR_EXTENSION_API_JSON_WEBREQUESTINTERNAL)); RegisterSchema("webSocketProxyPrivate", ReadFromResource( @@ -472,8 +434,6 @@ void ExtensionAPI::InitDefaultConfiguration() { IDR_EXTENSION_API_JSON_WEBSTORE)); RegisterSchema("webstorePrivate", ReadFromResource( IDR_EXTENSION_API_JSON_WEBSTOREPRIVATE)); - RegisterSchema("windows", ReadFromResource( - IDR_EXTENSION_API_JSON_WINDOWS)); // Schemas to be loaded via JSON generated from IDL files. GeneratedSchemas::Get(&unloaded_schemas_); diff --git a/chrome/common/extensions/api/file_browser_handler_internal.json b/chrome/common/extensions/api/file_browser_handler_internal.json index 38fa8d3..a50a0a8 100644 --- a/chrome/common/extensions/api/file_browser_handler_internal.json +++ b/chrome/common/extensions/api/file_browser_handler_internal.json @@ -5,6 +5,9 @@ [ { "namespace": "fileBrowserHandlerInternal", + "compiler_options": { + "implemented_in": "chrome/browser/chromeos/extensions/file_browser_handler_api.h" + }, "nodoc": true, "internal": true, "platforms": ["chromeos"], diff --git a/chrome/common/extensions/api/i18n.json b/chrome/common/extensions/api/i18n.json index db3c3f6..765760d 100644 --- a/chrome/common/extensions/api/i18n.json +++ b/chrome/common/extensions/api/i18n.json @@ -23,6 +23,7 @@ }, { "name": "getMessage", + "nocompile": true, "type": "function", "unprivileged": true, "description": "Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the <code>getMessage()</code> call is wrong — for example, <em>messageName</em> is not a string or the <em>substitutions</em> array has more than 9 elements — this method returns <code>undefined</code>.", diff --git a/chrome/common/extensions/api/storage.json b/chrome/common/extensions/api/storage.json index 3e02335..a75de09 100644 --- a/chrome/common/extensions/api/storage.json +++ b/chrome/common/extensions/api/storage.json @@ -6,6 +6,9 @@ { "namespace": "storage", "unprivileged": true, + "compiler_options": { + "generate_type_functions": true + }, "types": [ { "id": "StorageChange", diff --git a/chrome/common/extensions/api/windows.json b/chrome/common/extensions/api/windows.json index dbfe080..ee0702b 100644 --- a/chrome/common/extensions/api/windows.json +++ b/chrome/common/extensions/api/windows.json @@ -5,6 +5,9 @@ [ { "namespace": "windows", + "compiler_options": { + "implemented_in": "chrome/browser/extensions/api/tabs/tabs_api.h" + }, "dependencies": [ "tabs" ], "types": [ { diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py index db8d172..979e79e 100644 --- a/chrome/common/extensions/docs/server2/api_data_source.py +++ b/chrome/common/extensions/docs/server2/api_data_source.py @@ -14,9 +14,10 @@ import third_party.json_schema_compiler.idl_schema as idl_schema import third_party.json_schema_compiler.idl_parser as idl_parser # Increment this version when there are changes to the data stored in any of -# the caches used by APIDataSource. This allows the cache to be invalidated -# without having to flush memcache on the production server. -_VERSION = 9 +# the caches used by APIDataSource. This would include changes to model.py in +# JSON schema compiler! This allows the cache to be invalidated without having +# to flush memcache on the production server. +_VERSION = 10 def _RemoveNoDocs(item): if json_parse.IsDict(item): diff --git a/chrome/common/extensions_api_resources.grd b/chrome/common/extensions_api_resources.grd index bbf2c0d..915a1c8 100644 --- a/chrome/common/extensions_api_resources.grd +++ b/chrome/common/extensions_api_resources.grd @@ -10,57 +10,40 @@ <release seq="1"> <includes> <include name="IDR_EXTENSION_API_JSON_APP" file="extensions\api\app.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_BOOKMARKS" file="extensions\api\bookmarks.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_BOOKMARKMANAGERPRIVATE" file="extensions\api\bookmark_manager_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_BROWSERACTION" file="extensions\api\browser_action.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_BROWSINGDATA" file="extensions\api\browsing_data.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_CHROMEOSINFOPRIVATE" file="extensions\api\chromeos_info_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_CLOUDPRINTPRIVATE" file="extensions\api\cloud_print_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_COMMANDS" file="extensions\api\commands.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_CONTENTSETTINGS" file="extensions\api\content_settings.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_CONTEXTMENUS" file="extensions\api\context_menus.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_COOKIES" file="extensions\api\cookies.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_DEBUGGER" file="extensions\api\debugger.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST" file="extensions\api\declarative_web_request.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_DEVTOOLS" file="extensions\api\devtools.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_ECHOPRIVATE" file="extensions\api\echo_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_EVENTS" file="extensions\api\events.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_ACCESSIBILITY" file="extensions\api\experimental_accessibility.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP" file="extensions\api\experimental_app.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_HISTORY" file="extensions\api\experimental_history.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS" file="extensions\api\experimental_infobars.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD" file="extensions\api\experimental_input_virtual_keyboard.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_POWER" file="extensions\api\experimental_power.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_PROCESSES" file="extensions\api\experimental_processes.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_RECORD" file="extensions\api\experimental_record.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_RLZ" file="extensions\api\experimental_rlz.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_SPEECHINPUT" file="extensions\api\experimental_speech_input.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_EXTENSION" file="extensions\api\extension.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER" file="extensions\api\file_browser_handler.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_FILEBROWSERHANDLERINTERNAL" file="extensions\api\file_browser_handler_internal.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_FILEBROWSERPRIVATE" file="extensions\api\file_browser_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_FONTSSETTINGS" file="extensions\api\font_settings.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_HISTORY" file="extensions\api\history.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_I18N" file="extensions\api\i18n.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_INPUT_IME" file="extensions\api\input_ime.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_IDLE" file="extensions\api\idle.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE" file="extensions\api\input_method_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE" file="extensions\api\managed_mode_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_MANAGEMENT" file="extensions\api\management.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_MEDIAPLAYERPRIVATE" file="extensions\api\media_player_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_METRICSPRIVATE" file="extensions\api\metrics_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_OMNIBOX" file="extensions\api\omnibox.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_PAGEACTION" file="extensions\api\page_action.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_PAGEACTIONS" file="extensions\api\page_actions.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_PAGECAPTURE" file="extensions\api\page_capture.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_PERMISSIONS" file="extensions\api\permissions.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_PRIVACY" file="extensions\api\privacy.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_PROXY" file="extensions\api\proxy.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_RUNTIME" file="extensions\api\runtime.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_SCRIPTBADGE" file="extensions\api\script_badge.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_STORAGE" file="extensions\api\storage.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_SYSTEMPRIVATE" file="extensions\api\system_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_TABS" file="extensions\api\tabs.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_TERMINALPRIVATE" file="extensions\api\terminal_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_TEST" file="extensions\api\test.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_TOPSITES" file="extensions\api\top_sites.json" type="BINDATA" /> @@ -68,13 +51,10 @@ <include name="IDR_EXTENSION_API_JSON_TTSENGINE" file="extensions\api\tts_engine.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_TYPES" file="extensions\api\types.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_WALLPAPERPRIVATE" file="extensions\api\wallpaper_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_WEBNAVIGATION" file="extensions\api\web_navigation.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_WEBREQUEST" file="extensions\api\web_request.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_WEBSOCKETPROXYPRIVATE" file="extensions\api\web_socket_proxy_private.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_WEBREQUESTINTERNAL" file="extensions\api\web_request_internal.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_WEBSTORE" file="extensions\api\webstore.json" type="BINDATA" /> <include name="IDR_EXTENSION_API_JSON_WEBSTOREPRIVATE" file="extensions\api\webstore_private.json" type="BINDATA" /> - <include name="IDR_EXTENSION_API_JSON_WINDOWS" file="extensions\api\windows.json" type="BINDATA" /> </includes> </release> </grit> |