diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 06:05:40 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 06:05:40 +0000 |
commit | f93914857eb403a7aecf9154d14efae2703077e9 (patch) | |
tree | 816be10bf84bf1e7dca953092b23975ada90eb59 /chrome | |
parent | ab49e2e3c7f3fef9ebbf9749e8bf06765f644c21 (diff) | |
download | chromium_src-f93914857eb403a7aecf9154d14efae2703077e9.zip chromium_src-f93914857eb403a7aecf9154d14efae2703077e9.tar.gz chromium_src-f93914857eb403a7aecf9154d14efae2703077e9.tar.bz2 |
Separate out the string constants used for extension API function
names, function parameter keys, error messages and event names so that
they can be reused when writing extension UI tests.
Original review: http://codereview.chromium.org/113771
Review URL: http://codereview.chromium.org/113831
Patch from Joi Sigurdsson <joi.sigurdsson@gmail.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
17 files changed, 565 insertions, 285 deletions
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index a3d7b39..a1c1fdc 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -2028,6 +2028,14 @@ > </File> <File + RelativePath=".\extensions\extension_bookmarks_module_constants.cc" + > + </File> + <File + RelativePath=".\extensions\extension_bookmarks_module_constants.h" + > + </File> + <File RelativePath=".\extensions\extension_browser_event_router.cc" > </File> @@ -2052,6 +2060,14 @@ > </File> <File + RelativePath=".\extensions\extension_event_names.cc" + > + </File> + <File + RelativePath=".\extensions\extension_event_names.h" + > + </File> + <File RelativePath=".\extensions\extension_function.cc" > </File> @@ -2092,6 +2108,14 @@ > </File> <File + RelativePath=".\extensions\extension_page_actions_module_constants.cc" + > + </File> + <File + RelativePath=".\extensions\extension_page_actions_module_constants.h" + > + </File> + <File RelativePath=".\extensions\extension_process_manager.cc" > </File> @@ -2124,6 +2148,14 @@ > </File> <File + RelativePath=".\extensions\extension_tabs_module_constants.cc" + > + </File> + <File + RelativePath=".\extensions\extension_tabs_module_constants.h" + > + </File> + <File RelativePath=".\extensions\extension_view.cc" > </File> diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc index 3a175ed..8225f7a 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.cc +++ b/chrome/browser/extensions/extension_bookmarks_module.cc @@ -9,38 +9,11 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_list.h" +#include "chrome/browser/extensions/extension_bookmarks_module_constants.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/profile.h" -namespace { -// keys -const wchar_t* kIdKey = L"id"; -const wchar_t* kIndexKey = L"index"; -const wchar_t* kParentIdKey = L"parentId"; -const wchar_t* kOldIndexKey = L"oldIndex"; -const wchar_t* kOldParentIdKey = L"oldParentId"; -const wchar_t* kUrlKey = L"url"; -const wchar_t* kTitleKey = L"title"; -const wchar_t* kChildrenIdsKey = L"childrenIds"; -const wchar_t* kChildrenKey = L"childrenIds"; -const wchar_t* kRecursiveKey = L"recursive"; - -// errors -const char* kNoNodeError = "Can't find bookmark for id."; -const char* kNoParentError = "Can't find parent bookmark for id."; -const char* kFolderNotEmptyError = - "Can't remove non-empty folder (use recursive to force)."; -const char* kInvalidIndexError = "Index out of bounds."; -const char* kInvalidUrlError = "Invalid URL."; -const char* kModifySpecialError = "Can't modify the root bookmark folders."; - -// events -const char* kOnBookmarkAdded = "bookmark-added"; -const char* kOnBookmarkRemoved = "bookmark-removed"; -const char* kOnBookmarkChanged = "bookmark-changed"; -const char* kOnBookmarkMoved = "bookmark-moved"; -const char* kOnBookmarkChildrenReordered = "bookmark-children-reordered"; -}; +namespace keys = extension_bookmarks_module_constants; // Helper functions. class ExtensionBookmarks { @@ -48,16 +21,16 @@ class ExtensionBookmarks { // Convert |node| into a JSON value static DictionaryValue* GetNodeDictionary(BookmarkNode* node, bool recurse) { DictionaryValue* dict = new DictionaryValue(); - dict->SetInteger(kIdKey, node->id()); + dict->SetInteger(keys::kIdKey, node->id()); BookmarkNode* parent = node->GetParent(); if (parent) - dict->SetInteger(kParentIdKey, parent->id()); + dict->SetInteger(keys::kParentIdKey, parent->id()); if (!node->is_folder()) - dict->SetString(kUrlKey, node->GetURL().spec()); + dict->SetString(keys::kUrlKey, node->GetURL().spec()); - dict->SetString(kTitleKey, node->GetTitle()); + dict->SetString(keys::kTitleKey, node->GetTitle()); int childCount = node->GetChildCount(); ListValue* children = new ListValue(); @@ -72,9 +45,9 @@ class ExtensionBookmarks { } } if (recurse) - dict->Set(kChildrenKey, children); + dict->Set(keys::kChildrenKey, children); else - dict->Set(kChildrenIdsKey, children); + dict->Set(keys::kChildrenIdsKey, children); return dict; } @@ -136,16 +109,16 @@ void ExtensionBookmarkEventRouter::BookmarkNodeMoved(BookmarkModel* model, ListValue args; DictionaryValue* object_args = new DictionaryValue(); BookmarkNode* node = new_parent->GetChild(new_index); - object_args->SetInteger(kIdKey, node->id()); - object_args->SetInteger(kParentIdKey, new_parent->id()); - object_args->SetInteger(kIndexKey, new_index); - object_args->SetInteger(kOldParentIdKey, old_parent->id()); - object_args->SetInteger(kOldIndexKey, old_index); + object_args->SetInteger(keys::kIdKey, node->id()); + object_args->SetInteger(keys::kParentIdKey, new_parent->id()); + object_args->SetInteger(keys::kIndexKey, new_index); + object_args->SetInteger(keys::kOldParentIdKey, old_parent->id()); + object_args->SetInteger(keys::kOldIndexKey, old_index); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(model->profile(), kOnBookmarkMoved, json_args); + DispatchEvent(model->profile(), keys::kOnBookmarkMoved, json_args); } void ExtensionBookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, @@ -154,16 +127,16 @@ void ExtensionBookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, ListValue args; DictionaryValue* object_args = new DictionaryValue(); BookmarkNode* node = parent->GetChild(index); - object_args->SetInteger(kIdKey, node->id()); - object_args->SetString(kTitleKey, node->GetTitle()); - object_args->SetString(kUrlKey, node->GetURL().spec()); - object_args->SetInteger(kParentIdKey, parent->id()); - object_args->SetInteger(kIndexKey, index); + object_args->SetInteger(keys::kIdKey, node->id()); + object_args->SetString(keys::kTitleKey, node->GetTitle()); + object_args->SetString(keys::kUrlKey, node->GetURL().spec()); + object_args->SetInteger(keys::kParentIdKey, parent->id()); + object_args->SetInteger(keys::kIndexKey, index); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(model->profile(), kOnBookmarkAdded, json_args); + DispatchEvent(model->profile(), keys::kOnBookmarkAdded, json_args); } void ExtensionBookmarkEventRouter::BookmarkNodeRemoved(BookmarkModel* model, @@ -171,13 +144,13 @@ void ExtensionBookmarkEventRouter::BookmarkNodeRemoved(BookmarkModel* model, int index) { ListValue args; DictionaryValue* object_args = new DictionaryValue(); - object_args->SetInteger(kParentIdKey, parent->id()); - object_args->SetInteger(kIndexKey, index); + object_args->SetInteger(keys::kParentIdKey, parent->id()); + object_args->SetInteger(keys::kIndexKey, index); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(model->profile(), kOnBookmarkRemoved, json_args); + DispatchEvent(model->profile(), keys::kOnBookmarkRemoved, json_args); } void ExtensionBookmarkEventRouter::BookmarkNodeChanged(BookmarkModel* model, @@ -191,12 +164,12 @@ void ExtensionBookmarkEventRouter::BookmarkNodeChanged(BookmarkModel* model, // we only include title. The ideal thing would be to change BookmarkModel // to indicate what changed. DictionaryValue* object_args = new DictionaryValue(); - object_args->SetString(kTitleKey, node->GetTitle()); + object_args->SetString(keys::kTitleKey, node->GetTitle()); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(model->profile(), kOnBookmarkChanged, json_args); + DispatchEvent(model->profile(), keys::kOnBookmarkChanged, json_args); } void ExtensionBookmarkEventRouter::BookmarkNodeFavIconLoaded( @@ -219,7 +192,9 @@ void ExtensionBookmarkEventRouter::BookmarkNodeChildrenReordered( std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(model->profile(), kOnBookmarkChildrenReordered, json_args); + DispatchEvent(model->profile(), + keys::kOnBookmarkChildrenReordered, + json_args); } bool GetBookmarksFunction::RunImpl() { @@ -235,7 +210,7 @@ bool GetBookmarksFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&id)); BookmarkNode* node = model->GetNodeByID(id); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } ExtensionBookmarks::AddNode(node, json.get(), false); @@ -256,7 +231,7 @@ bool GetBookmarksFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(ids->GetInteger(i, &id)); BookmarkNode* node = model->GetNodeByID(id); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } else { ExtensionBookmarks::AddNode(node, json.get(), false); @@ -279,7 +254,7 @@ bool GetBookmarkChildrenFunction::RunImpl() { scoped_ptr<ListValue> json(new ListValue()); BookmarkNode* node = model->GetNodeByID(id); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } int child_count = node->GetChildCount(); @@ -327,31 +302,31 @@ bool RemoveBookmarkFunction::RunImpl() { // TODO(erikkay): it would be cool to take a list here as well. int id; - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kIdKey, &id)); + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kIdKey, &id)); bool recursive = false; - json->GetBoolean(kRecursiveKey, &recursive); // optional + json->GetBoolean(keys::kRecursiveKey, &recursive); // optional BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkNode* node = model->GetNodeByID(id); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } if (node == model->root_node() || node == model->other_node() || node == model->GetBookmarkBarNode()) { - error_ = kModifySpecialError; + error_ = keys::kModifySpecialError; return false; } if (node->is_folder() && node->GetChildCount() > 0 && !recursive) { - error_ = kFolderNotEmptyError; + error_ = keys::kFolderNotEmptyError; return false; } BookmarkNode* parent = node->GetParent(); if (!parent) { - error_ = kNoParentError; + error_ = keys::kNoParentError; return false; } int index = parent->IndexOfChild(node); @@ -365,39 +340,41 @@ bool CreateBookmarkFunction::RunImpl() { BookmarkModel* model = profile()->GetBookmarkModel(); int parentId; - if (!json->HasKey(kParentIdKey)) { // optional, default to "other bookmarks" + if (!json->HasKey(keys::kParentIdKey)) { + // optional, default to "other bookmarks" parentId = model->other_node()->id(); } else { - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kParentIdKey, &parentId)); + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kParentIdKey, + &parentId)); } BookmarkNode* parent = model->GetNodeByID(parentId); if (!parent) { - error_ = kNoParentError; + error_ = keys::kNoParentError; return false; } if (parent->GetParent() == NULL) { // can't create children of the root - error_ = kNoParentError; + error_ = keys::kNoParentError; return false; } int index; - if (!json->HasKey(kIndexKey)) { // optional (defaults to end) + if (!json->HasKey(keys::kIndexKey)) { // optional (defaults to end) index = parent->GetChildCount(); } else { - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kIndexKey, &index)); + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kIndexKey, &index)); if (index > parent->GetChildCount() || index < 0) { - error_ = kInvalidIndexError; + error_ = keys::kInvalidIndexError; return false; } } std::wstring title; - json->GetString(kTitleKey, &title); // optional + json->GetString(keys::kTitleKey, &title); // optional std::string url_string; - json->GetString(kUrlKey, &url_string); // optional + json->GetString(keys::kUrlKey, &url_string); // optional GURL url(url_string); if (!url.is_empty() && !url.is_valid()) { - error_ = kInvalidUrlError; + error_ = keys::kInvalidUrlError; return false; } @@ -408,7 +385,7 @@ bool CreateBookmarkFunction::RunImpl() { node = model->AddGroup(parent, index, title); DCHECK(node); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } @@ -424,44 +401,46 @@ bool MoveBookmarkFunction::RunImpl() { // TODO(erikkay) it would be cool if this could be a list of ids as well int id = 0; - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kIdKey, &id)); + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kIdKey, &id)); BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkNode* node = model->GetNodeByID(id); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } if (node == model->root_node() || node == model->other_node() || node == model->GetBookmarkBarNode()) { - error_ = kModifySpecialError; + error_ = keys::kModifySpecialError; return false; } BookmarkNode* parent; - if (!json->HasKey(kParentIdKey)) { // optional, defaults to current parent + if (!json->HasKey(keys::kParentIdKey)) { + // optional, defaults to current parent parent = node->GetParent(); } else { int parentId; - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kParentIdKey, &parentId)); + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kParentIdKey, + &parentId)); parent = model->GetNodeByID(parentId); } if (!parent) { - error_ = kNoParentError; + error_ = keys::kNoParentError; // TODO(erikkay) return an error message return false; } if (parent == model->root_node()) { - error_ = kModifySpecialError; + error_ = keys::kModifySpecialError; return false; } int index; - if (json->HasKey(kIndexKey)) { // optional (defaults to end) - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kIndexKey, &index)); + if (json->HasKey(keys::kIndexKey)) { // optional (defaults to end) + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kIndexKey, &index)); if (index > parent->GetChildCount() || index < 0) { - error_ = kInvalidIndexError; + error_ = keys::kInvalidIndexError; return false; } } else { @@ -477,20 +456,20 @@ bool SetBookmarkTitleFunction::RunImpl() { DictionaryValue* json = static_cast<DictionaryValue*>(args_); std::wstring title; - json->GetString(kTitleKey, &title); // optional (empty is clear) + json->GetString(keys::kTitleKey, &title); // optional (empty is clear) BookmarkModel* model = profile()->GetBookmarkModel(); int id = 0; - EXTENSION_FUNCTION_VALIDATE(json->GetInteger(kIdKey, &id)); + EXTENSION_FUNCTION_VALIDATE(json->GetInteger(keys::kIdKey, &id)); BookmarkNode* node = model->GetNodeByID(id); if (!node) { - error_ = kNoNodeError; + error_ = keys::kNoNodeError; return false; } if (node == model->root_node() || node == model->other_node() || node == model->GetBookmarkBarNode()) { - error_ = kModifySpecialError; + error_ = keys::kModifySpecialError; return false; } model->SetTitle(node, title); diff --git a/chrome/browser/extensions/extension_bookmarks_module.h b/chrome/browser/extensions/extension_bookmarks_module.h index def5440..a2b6a084 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.h +++ b/chrome/browser/extensions/extension_bookmarks_module.h @@ -11,6 +11,7 @@ #include "base/singleton.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/extensions/extension_function.h" +#include "chrome/browser/extensions/extension_tabs_module.h" // Observes BookmarkModel and then routes the notifications as events to // the extension system. diff --git a/chrome/browser/extensions/extension_bookmarks_module_constants.cc b/chrome/browser/extensions/extension_bookmarks_module_constants.cc new file mode 100755 index 0000000..9b3bc31 --- /dev/null +++ b/chrome/browser/extensions/extension_bookmarks_module_constants.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2009 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/extension_bookmarks_module_constants.h" + +namespace extension_bookmarks_module_constants { + +const wchar_t kIdKey[] = L"id"; +const wchar_t kIndexKey[] = L"index"; +const wchar_t kParentIdKey[] = L"parentId"; +const wchar_t kOldIndexKey[] = L"oldIndex"; +const wchar_t kOldParentIdKey[] = L"oldParentId"; +const wchar_t kUrlKey[] = L"url"; +const wchar_t kTitleKey[] = L"title"; +const wchar_t kChildrenIdsKey[] = L"childrenIds"; +const wchar_t kChildrenKey[] = L"childrenIds"; +const wchar_t kRecursiveKey[] = L"recursive"; + +const char kNoNodeError[] = "Can't find bookmark for id."; +const char kNoParentError[] = "Can't find parent bookmark for id."; +const char kFolderNotEmptyError[] = + "Can't remove non-empty folder (use recursive to force)."; +const char kInvalidIndexError[] = "Index out of bounds."; +const char kInvalidUrlError[] = "Invalid URL."; +const char kModifySpecialError[] = "Can't modify the root bookmark folders."; + +const char kOnBookmarkAdded[] = "bookmark-added"; +const char kOnBookmarkRemoved[] = "bookmark-removed"; +const char kOnBookmarkChanged[] = "bookmark-changed"; +const char kOnBookmarkMoved[] = "bookmark-moved"; +const char kOnBookmarkChildrenReordered[] = "bookmark-children-reordered"; + +const char kGetBookmarksFunction[] = "GetBookmarks"; +const char kGetBookmarkChildrenFunction[] = "GetBookmarkChildren"; +const char kGetBookmarkTreeFunction[] = "GetBookmarkTree"; +const char kSearchBookmarksFunction[] = "SearchBookmarks"; +const char kRemoveBookmarkFunction[] = "RemoveBookmark"; +const char kCreateBookmarkFunction[] = "CreateBookmark"; +const char kMoveBookmarkFunction[] = "MoveBookmark"; +const char kSetBookmarkTitleFunction[] = "SetBookmarkTitle"; + +} // namespace extension_bookmarks_module_constants diff --git a/chrome/browser/extensions/extension_bookmarks_module_constants.h b/chrome/browser/extensions/extension_bookmarks_module_constants.h new file mode 100755 index 0000000..7c1b5fb --- /dev/null +++ b/chrome/browser/extensions/extension_bookmarks_module_constants.h @@ -0,0 +1,51 @@ +// Copyright (c) 2009 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. + +// Constants used to for the Bookmarks API. + +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_CONSTANTS_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_CONSTANTS_H_ + +namespace extension_bookmarks_module_constants { + +// Keys. +extern const wchar_t kIdKey[]; +extern const wchar_t kIndexKey[]; +extern const wchar_t kParentIdKey[]; +extern const wchar_t kOldIndexKey[]; +extern const wchar_t kOldParentIdKey[]; +extern const wchar_t kUrlKey[]; +extern const wchar_t kTitleKey[]; +extern const wchar_t kChildrenIdsKey[]; +extern const wchar_t kChildrenKey[]; +extern const wchar_t kRecursiveKey[]; + +// Errors. +extern const char kNoNodeError[]; +extern const char kNoParentError[]; +extern const char kFolderNotEmptyError[]; +extern const char kInvalidIndexError[]; +extern const char kInvalidUrlError[]; +extern const char kModifySpecialError[]; + +// Events. +extern const char kOnBookmarkAdded[]; +extern const char kOnBookmarkRemoved[]; +extern const char kOnBookmarkChanged[]; +extern const char kOnBookmarkMoved[]; +extern const char kOnBookmarkChildrenReordered[]; + +// Function names. +extern const char kGetBookmarksFunction[]; +extern const char kGetBookmarkChildrenFunction[]; +extern const char kGetBookmarkTreeFunction[]; +extern const char kSearchBookmarksFunction[]; +extern const char kRemoveBookmarkFunction[]; +extern const char kCreateBookmarkFunction[]; +extern const char kMoveBookmarkFunction[]; +extern const char kSetBookmarkTitleFunction[]; + +}; // namespace extension_bookmarks_module_constants + +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_CONSTANTS_H_ diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index df4ab5b..30699f5 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -9,21 +9,14 @@ #include "chrome/browser/browser.h" #include "chrome/browser/profile.h" #include "chrome/browser/extensions/extension.h" +#include "chrome/browser/extensions/extension_event_names.h" #include "chrome/browser/extensions/extension_message_service.h" +#include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/notification_service.h" -const char* kOnPageActionExecuted = "page-action-executed"; -const char* kOnTabAttached = "tab-attached"; -const char* kOnTabCreated = "tab-created"; -const char* kOnTabDetached = "tab-detached"; -const char* kOnTabMoved = "tab-moved"; -const char* kOnTabRemoved = "tab-removed"; -const char* kOnTabSelectionChanged = "tab-selection-changed"; -const char* kOnTabUpdated = "tab-updated"; -const char* kOnWindowCreated = "window-created"; -const char* kOnWindowFocusedChanged = "window-focus-changed"; -const char* kOnWindowRemoved = "window-removed"; +namespace events = extension_event_names; +namespace tab_keys = extension_tabs_module_constants; ExtensionBrowserEventRouter::TabEntry::TabEntry() : state_(ExtensionTabUtil::TAB_COMPLETE), @@ -55,8 +48,8 @@ DictionaryValue* ExtensionBrowserEventRouter::TabEntry::UpdateLoadState( } else if (state_ == ExtensionTabUtil::TAB_COMPLETE) { // Send "complete" state change. DictionaryValue* changed_properties = new DictionaryValue(); - changed_properties->SetString(ExtensionTabUtil::kStatusKey, - ExtensionTabUtil::kStatusValueComplete); + changed_properties->SetString(tab_keys::kStatusKey, + tab_keys::kStatusValueComplete); return changed_properties; } else { @@ -71,13 +64,13 @@ DictionaryValue* ExtensionBrowserEventRouter::TabEntry::DidNavigate( return NULL; DictionaryValue* changed_properties = new DictionaryValue(); - changed_properties->SetString(ExtensionTabUtil::kStatusKey, - ExtensionTabUtil::kStatusValueLoading); + changed_properties->SetString(tab_keys::kStatusKey, + tab_keys::kStatusValueLoading); GURL new_url = contents->GetURL(); if (new_url != url_) { url_ = new_url; - changed_properties->SetString(ExtensionTabUtil::kUrlKey, url_.spec()); + changed_properties->SetString(tab_keys::kUrlKey, url_.spec()); } pending_navigate_ = false; @@ -124,7 +117,7 @@ void ExtensionBrowserEventRouter::OnBrowserAdded(const Browser* browser) { DispatchSimpleBrowserEvent(browser->profile(), ExtensionTabUtil::GetWindowId(browser), - kOnWindowCreated); + events::kOnWindowCreated); } void ExtensionBrowserEventRouter::OnBrowserRemoving(const Browser* browser) { @@ -133,14 +126,14 @@ void ExtensionBrowserEventRouter::OnBrowserRemoving(const Browser* browser) { DispatchSimpleBrowserEvent(browser->profile(), ExtensionTabUtil::GetWindowId(browser), - kOnWindowRemoved); + events::kOnWindowRemoved); } void ExtensionBrowserEventRouter::OnBrowserSetLastActive( const Browser* browser) { DispatchSimpleBrowserEvent(browser->profile(), ExtensionTabUtil::GetWindowId(browser), - kOnWindowFocusedChanged); + events::kOnWindowFocusedChanged); } void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents, @@ -151,7 +144,7 @@ void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents, std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(contents->profile(), kOnTabCreated, json_args); + DispatchEvent(contents->profile(), events::kOnTabCreated, json_args); registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, Source<NavigationController>(&contents->controller())); @@ -173,16 +166,16 @@ void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents, args.Append(Value::CreateIntegerValue(tab_id)); DictionaryValue *object_args = new DictionaryValue(); - object_args->Set(ExtensionTabUtil::kNewWindowIdKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kNewWindowIdKey, Value::CreateIntegerValue( ExtensionTabUtil::GetWindowIdOfTab(contents))); - object_args->Set(ExtensionTabUtil::kNewPositionKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kNewPositionKey, Value::CreateIntegerValue( index)); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(contents->profile(), kOnTabAttached, json_args); + DispatchEvent(contents->profile(), events::kOnTabAttached, json_args); } void ExtensionBrowserEventRouter::TabDetachedAt(TabContents* contents, @@ -197,16 +190,16 @@ void ExtensionBrowserEventRouter::TabDetachedAt(TabContents* contents, args.Append(Value::CreateIntegerValue(tab_id)); DictionaryValue *object_args = new DictionaryValue(); - object_args->Set(ExtensionTabUtil::kOldWindowIdKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kOldWindowIdKey, Value::CreateIntegerValue( ExtensionTabUtil::GetWindowIdOfTab(contents))); - object_args->Set(ExtensionTabUtil::kOldPositionKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kOldPositionKey, Value::CreateIntegerValue( index)); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(contents->profile(), kOnTabDetached, json_args); + DispatchEvent(contents->profile(), events::kOnTabDetached, json_args); } void ExtensionBrowserEventRouter::TabClosingAt(TabContents* contents, @@ -219,7 +212,7 @@ void ExtensionBrowserEventRouter::TabClosingAt(TabContents* contents, std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(contents->profile(), kOnTabRemoved, json_args); + DispatchEvent(contents->profile(), events::kOnTabRemoved, json_args); int removed_count = tab_entries_.erase(tab_id); DCHECK(removed_count > 0); @@ -237,14 +230,15 @@ void ExtensionBrowserEventRouter::TabSelectedAt(TabContents* old_contents, ExtensionTabUtil::GetTabId(new_contents))); DictionaryValue *object_args = new DictionaryValue(); - object_args->Set(ExtensionTabUtil::kWindowIdKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue( ExtensionTabUtil::GetWindowIdOfTab(new_contents))); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(new_contents->profile(), kOnTabSelectionChanged, json_args); + DispatchEvent(new_contents->profile(), events::kOnTabSelectionChanged, + json_args); } void ExtensionBrowserEventRouter::TabMoved(TabContents* contents, @@ -254,18 +248,18 @@ void ExtensionBrowserEventRouter::TabMoved(TabContents* contents, args.Append(Value::CreateIntegerValue(ExtensionTabUtil::GetTabId(contents))); DictionaryValue *object_args = new DictionaryValue(); - object_args->Set(ExtensionTabUtil::kWindowIdKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue( ExtensionTabUtil::GetWindowIdOfTab(contents))); - object_args->Set(ExtensionTabUtil::kFromIndexKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kFromIndexKey, Value::CreateIntegerValue( from_index)); - object_args->Set(ExtensionTabUtil::kToIndexKey, Value::CreateIntegerValue( + object_args->Set(tab_keys::kToIndexKey, Value::CreateIntegerValue( to_index)); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(contents->profile(), kOnTabMoved, json_args); + DispatchEvent(contents->profile(), events::kOnTabMoved, json_args); } void ExtensionBrowserEventRouter::TabUpdated(TabContents* contents, @@ -291,7 +285,7 @@ void ExtensionBrowserEventRouter::TabUpdated(TabContents* contents, std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(contents->profile(), kOnTabUpdated, json_args); + DispatchEvent(contents->profile(), events::kOnTabUpdated, json_args); } } @@ -321,17 +315,17 @@ void ExtensionBrowserEventRouter::PageActionExecuted(Profile *profile, std::string url) { ListValue args; DictionaryValue *object_args = new DictionaryValue(); - object_args->Set(ExtensionTabUtil::kPageActionIdKey, + object_args->Set(tab_keys::kPageActionIdKey, Value::CreateStringValue(page_action_id)); DictionaryValue *data = new DictionaryValue(); - data->Set(ExtensionTabUtil::kTabIdKey, Value::CreateIntegerValue(tab_id)); - data->Set(ExtensionTabUtil::kTabUrlKey, Value::CreateStringValue(url)); - object_args->Set(ExtensionTabUtil::kDataKey, data); + data->Set(tab_keys::kTabIdKey, Value::CreateIntegerValue(tab_id)); + data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url)); + object_args->Set(tab_keys::kDataKey, data); args.Append(object_args); std::string json_args; JSONWriter::Write(&args, false, &json_args); - DispatchEvent(profile, kOnPageActionExecuted, json_args); + DispatchEvent(profile, events::kOnPageActionExecuted, json_args); } diff --git a/chrome/browser/extensions/extension_event_names.cc b/chrome/browser/extensions/extension_event_names.cc new file mode 100755 index 0000000..f4fd6e7 --- /dev/null +++ b/chrome/browser/extensions/extension_event_names.cc @@ -0,0 +1,22 @@ +// Copyright (c) 2009 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/extension_event_names.h" + +namespace extension_event_names { + +const char kOnPageActionExecuted[] = "page-action-executed"; +const char kOnTabAttached[] = "tab-attached"; +const char kOnTabCreated[] = "tab-created"; +const char kOnTabDetached[] = "tab-detached"; +const char kOnTabMoved[] = "tab-moved"; +const char kOnTabRemoved[] = "tab-removed"; +const char kOnTabSelectionChanged[] = "tab-selection-changed"; +const char kOnTabUpdated[] = "tab-updated"; +const char kOnWindowCreated[] = "window-created"; +const char kOnWindowFocusedChanged[] = "window-focus-changed"; +const char kOnWindowRemoved[] = "window-removed"; + +} // namespace extension_event_names + diff --git a/chrome/browser/extensions/extension_event_names.h b/chrome/browser/extensions/extension_event_names.h new file mode 100755 index 0000000..9b9e3f2 --- /dev/null +++ b/chrome/browser/extensions/extension_event_names.h @@ -0,0 +1,27 @@ +// Copyright (c) 2009 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. + +// Constants for the event names sent to extensions. + +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_NAMES_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_NAMES_H_ + +namespace extension_event_names { + +extern const char kOnPageActionExecuted[]; +extern const char kOnTabAttached[]; +extern const char kOnTabCreated[]; +extern const char kOnTabDetached[]; +extern const char kOnTabMoved[]; +extern const char kOnTabRemoved[]; +extern const char kOnTabSelectionChanged[]; +extern const char kOnTabUpdated[]; +extern const char kOnWindowCreated[]; +extern const char kOnWindowFocusedChanged[]; +extern const char kOnWindowRemoved[]; + +}; // namespace extension_event_names + +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_NAMES_H_ + diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 135e657..dc5c8f1 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -8,10 +8,13 @@ #include "base/singleton.h" #include "base/values.h" #include "chrome/browser/extensions/extension_bookmarks_module.h" +#include "chrome/browser/extensions/extension_bookmarks_module_constants.h" #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extension_page_actions_module.h" +#include "chrome/browser/extensions/extension_page_actions_module_constants.h" #include "chrome/browser/extensions/extension_tabs_module.h" +#include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -60,46 +63,62 @@ FactoryRegistry* FactoryRegistry::instance() { void FactoryRegistry::ResetFunctions() { // Register all functions here. + namespace tabs = extension_tabs_module_constants; + namespace page_actions = extension_page_actions_module_constants; + namespace bookmarks = extension_bookmarks_module_constants; + // Windows - factories_["GetWindow"] = &NewExtensionFunction<GetWindowFunction>; - factories_["GetCurrentWindow"] = + factories_[tabs::kGetWindowFunction] = + &NewExtensionFunction<GetWindowFunction>; + factories_[tabs::kGetCurrentWindowFunction] = &NewExtensionFunction<GetCurrentWindowFunction>; - factories_["GetLastFocusedWindow"] = + factories_[tabs::kGetLastFocusedWindowFunction] = &NewExtensionFunction<GetLastFocusedWindowFunction>; - factories_["GetAllWindows"] = &NewExtensionFunction<GetAllWindowsFunction>; - factories_["CreateWindow"] = &NewExtensionFunction<CreateWindowFunction>; - factories_["UpdateWindow"] = &NewExtensionFunction<UpdateWindowFunction>; - factories_["RemoveWindow"] = &NewExtensionFunction<RemoveWindowFunction>; + factories_[tabs::kGetAllWindowsFunction] = + &NewExtensionFunction<GetAllWindowsFunction>; + factories_[tabs::kCreateWindowFunction] = + &NewExtensionFunction<CreateWindowFunction>; + factories_[tabs::kUpdateWindowFunction] = + &NewExtensionFunction<UpdateWindowFunction>; + factories_[tabs::kRemoveWindowFunction] = + &NewExtensionFunction<RemoveWindowFunction>; // Tabs - factories_["GetTab"] = &NewExtensionFunction<GetTabFunction>; - factories_["GetSelectedTab"] = + factories_[tabs::kGetTabFunction] = + &NewExtensionFunction<GetTabFunction>; + factories_[tabs::kGetSelectedTabFunction] = &NewExtensionFunction<GetSelectedTabFunction>; - factories_["GetAllTabsInWindow"] = + factories_[tabs::kGetAllTabsInWindowFunction] = &NewExtensionFunction<GetAllTabsInWindowFunction>; - factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>; - factories_["UpdateTab"] = &NewExtensionFunction<UpdateTabFunction>; - factories_["MoveTab"] = &NewExtensionFunction<MoveTabFunction>; - factories_["RemoveTab"] = &NewExtensionFunction<RemoveTabFunction>; + factories_[tabs::kCreateTabFunction] = + &NewExtensionFunction<CreateTabFunction>; + factories_[tabs::kUpdateTabFunction] = + &NewExtensionFunction<UpdateTabFunction>; + factories_[tabs::kMoveTabFunction] = + &NewExtensionFunction<MoveTabFunction>; + factories_[tabs::kRemoveTabFunction] = + &NewExtensionFunction<RemoveTabFunction>; // Page Actions. - factories_["EnablePageAction"] = + factories_[page_actions::kEnablePageActionFunction] = &NewExtensionFunction<EnablePageActionFunction>; // Bookmarks. - factories_["GetBookmarks"] = &NewExtensionFunction<GetBookmarksFunction>; - factories_["GetBookmarkChildren"] = + factories_[bookmarks::kGetBookmarksFunction] = + &NewExtensionFunction<GetBookmarksFunction>; + factories_[bookmarks::kGetBookmarkChildrenFunction] = &NewExtensionFunction<GetBookmarkChildrenFunction>; - factories_["GetBookmarkTree"] = + factories_[bookmarks::kGetBookmarkTreeFunction] = &NewExtensionFunction<GetBookmarkTreeFunction>; - factories_["SearchBookmarks"] = + factories_[bookmarks::kSearchBookmarksFunction] = &NewExtensionFunction<SearchBookmarksFunction>; - factories_["RemoveBookmark"] = + factories_[bookmarks::kRemoveBookmarkFunction] = &NewExtensionFunction<RemoveBookmarkFunction>; - factories_["CreateBookmark"] = + factories_[bookmarks::kCreateBookmarkFunction] = &NewExtensionFunction<CreateBookmarkFunction>; - factories_["MoveBookmark"] = &NewExtensionFunction<MoveBookmarkFunction>; - factories_["SetBookmarkTitle"] = + factories_[bookmarks::kMoveBookmarkFunction] = + &NewExtensionFunction<MoveBookmarkFunction>; + factories_[bookmarks::kSetBookmarkTitleFunction] = &NewExtensionFunction<SetBookmarkTitleFunction>; } diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc index d1fa723..fb686d8 100644 --- a/chrome/browser/extensions/extension_page_actions_module.cc +++ b/chrome/browser/extensions/extension_page_actions_module.cc @@ -9,17 +9,12 @@ #include "chrome/browser/profile.h" #include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_error_utils.h" +#include "chrome/browser/extensions/extension_page_actions_module_constants.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/tab_contents/navigation_entry.h" -namespace { - // Error messages. - const char* kNoExtensionError = "No extension with id: *."; - const char* kNoTabError = "No tab with id: *."; - const char* kNoPageActionError = "No PageAction with id: *."; - const char* kUrlNotActiveError = "This url is no longer active: *."; -} +namespace keys = extension_page_actions_module_constants; bool EnablePageActionFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST)); @@ -31,22 +26,23 @@ bool EnablePageActionFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args->GetDictionary(1, &action)); int tab_id; - EXTENSION_FUNCTION_VALIDATE(action->GetInteger(L"tabId", &tab_id)); + EXTENSION_FUNCTION_VALIDATE(action->GetInteger(keys::kTabIdKey, &tab_id)); std::string url; - EXTENSION_FUNCTION_VALIDATE(action->GetString(L"url", &url)); + EXTENSION_FUNCTION_VALIDATE(action->GetString(keys::kUrlKey, &url)); // Find the TabContents that contains this tab id. TabContents* contents = NULL; ExtensionTabUtil::GetTabById(tab_id, profile(), NULL, NULL, &contents, NULL); if (!contents) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kNoTabError, + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kNoTabError, IntToString(tab_id)); return false; } // Make sure the URL hasn't changed. if (url != contents->controller().GetActiveEntry()->url().spec()) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url); + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kUrlNotActiveError, + url); return false; } @@ -55,14 +51,14 @@ bool EnablePageActionFunction::RunImpl() { ExtensionsService* service = profile()->GetExtensionsService(); extension = service->GetExtensionByID(extension_id()); if (!extension) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kNoExtensionError, + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kNoExtensionError, extension_id()); return false; } const PageAction* page_action = extension->GetPageAction(page_action_id); if (!page_action) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kNoPageActionError, + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kNoPageActionError, page_action_id); return false; } diff --git a/chrome/browser/extensions/extension_page_actions_module_constants.cc b/chrome/browser/extensions/extension_page_actions_module_constants.cc new file mode 100755 index 0000000..5471483 --- /dev/null +++ b/chrome/browser/extensions/extension_page_actions_module_constants.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2009 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/extension_page_actions_module_constants.h" + +namespace extension_page_actions_module_constants { + +const wchar_t kTabIdKey[] = L"tabId"; +const wchar_t kUrlKey[] = L"url"; + +const char kNoExtensionError[] = "No extension with id: *."; +const char kNoTabError[] = "No tab with id: *."; +const char kNoPageActionError[] = "No PageAction with id: *."; +const char kUrlNotActiveError[] = "This url is no longer active: *."; + +const char kEnablePageActionFunction[] = "EnablePageAction"; + +} // namespace extension_page_actions_module_constants diff --git a/chrome/browser/extensions/extension_page_actions_module_constants.h b/chrome/browser/extensions/extension_page_actions_module_constants.h new file mode 100755 index 0000000..a3ce33c --- /dev/null +++ b/chrome/browser/extensions/extension_page_actions_module_constants.h @@ -0,0 +1,27 @@ +// Copyright (c) 2009 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. + +// Constants used for the Page Actions API. + +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_CONSTANTS_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_CONSTANTS_H_ + +namespace extension_page_actions_module_constants { + +// Keys. +extern const wchar_t kTabIdKey[]; +extern const wchar_t kUrlKey[]; + +// Error messages. +extern const char kNoExtensionError[]; +extern const char kNoTabError[]; +extern const char kNoPageActionError[]; +extern const char kUrlNotActiveError[]; + +// Function names. +extern const char kEnablePageActionFunction[]; + +}; // namespace extension_page_actions_module_constants + +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PAGE_ACTIONS_MODULE_CONSTANTS_H_ diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index cddafa5..c7bb630 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/extension.h" #include "chrome/browser/extensions/extension_error_utils.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" +#include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/browser/tab_contents/navigation_entry.h" @@ -21,12 +22,7 @@ #include "chrome/common/temp_scaffolding_stubs.h" #endif -namespace { -// Error messages. -const char* kWindowNotFoundError = "No window with id: *."; -const char* kTabNotFoundError = "No tab with id: *."; -const char* kInvalidUrlError = "Invalid url: \"*\"."; -} +namespace keys = extension_tabs_module_constants; // Forward declare static helper functions defined below. static DictionaryValue* CreateWindowValue(Browser* browser, bool populate_tabs); @@ -49,36 +45,6 @@ static bool GetTabById(int tab_id, Profile* profile, Browser** browser, static GURL AbsolutePath(Profile* profile, std::string extension_id, std::string relative_url); -// ExtensionTabUtil -const wchar_t* ExtensionTabUtil::kDataKey = L"data"; -const wchar_t* ExtensionTabUtil::kFavIconUrlKey = L"favIconUrl"; -const wchar_t* ExtensionTabUtil::kFocusedKey = L"focused"; -const wchar_t* ExtensionTabUtil::kFromIndexKey = L"fromIndex"; -const wchar_t* ExtensionTabUtil::kHeightKey = L"height"; -const wchar_t* ExtensionTabUtil::kIdKey = L"id"; -const wchar_t* ExtensionTabUtil::kIndexKey = L"index"; -const wchar_t* ExtensionTabUtil::kLeftKey = L"left"; -const wchar_t* ExtensionTabUtil::kNewPositionKey = L"newPosition"; -const wchar_t* ExtensionTabUtil::kNewWindowIdKey = L"newWindowId"; -const wchar_t* ExtensionTabUtil::kOldPositionKey = L"oldPosition"; -const wchar_t* ExtensionTabUtil::kOldWindowIdKey = L"oldWindowId"; -const wchar_t* ExtensionTabUtil::kPageActionIdKey = L"pageActionId"; -const wchar_t* ExtensionTabUtil::kSelectedKey = L"selected"; -const wchar_t* ExtensionTabUtil::kStatusKey = L"status"; -const wchar_t* ExtensionTabUtil::kTabIdKey = L"tabId"; -const wchar_t* ExtensionTabUtil::kTabsKey = L"tabs"; -const wchar_t* ExtensionTabUtil::kTabUrlKey = L"tabUrl"; -const wchar_t* ExtensionTabUtil::kTitleKey = L"title"; -const wchar_t* ExtensionTabUtil::kToIndexKey = L"toIndex"; -const wchar_t* ExtensionTabUtil::kTopKey = L"top"; -const wchar_t* ExtensionTabUtil::kUrlKey = L"url"; -const wchar_t* ExtensionTabUtil::kWidthKey = L"width"; -const wchar_t* ExtensionTabUtil::kWindowIdKey = L"windowId"; - -// Value consts. -const char* ExtensionTabUtil::kStatusValueComplete = "complete"; -const char* ExtensionTabUtil::kStatusValueLoading = "loading"; - int ExtensionTabUtil::GetWindowId(const Browser* browser) { return browser->session_id().id(); } @@ -96,10 +62,10 @@ std::string ExtensionTabUtil::GetTabStatusText(TabStatus status) { std::string text; switch (status) { case TAB_LOADING: - text = kStatusValueLoading; + text = keys::kStatusValueLoading; break; case TAB_COMPLETE: - text = kStatusValueComplete; + text = keys::kStatusValueComplete; break; } @@ -131,22 +97,22 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue( TabStatus status = GetTabStatus(contents); DictionaryValue* result = new DictionaryValue(); - result->SetInteger(kIdKey, ExtensionTabUtil::GetTabId(contents)); - result->SetInteger(kIndexKey, tab_index); - result->SetInteger(kWindowIdKey, + result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents)); + result->SetInteger(keys::kIndexKey, tab_index); + result->SetInteger(keys::kWindowIdKey, ExtensionTabUtil::GetWindowIdOfTab(contents)); - result->SetString(kUrlKey, contents->GetURL().spec()); - result->SetString(kStatusKey, GetTabStatusText(status)); - result->SetBoolean(kSelectedKey, + result->SetString(keys::kUrlKey, contents->GetURL().spec()); + result->SetString(keys::kStatusKey, GetTabStatusText(status)); + result->SetBoolean(keys::kSelectedKey, tab_strip && tab_index == tab_strip->selected_index()); if (status != TAB_LOADING) { - result->SetString(kTitleKey, UTF16ToWide(contents->GetTitle())); + result->SetString(keys::kTitleKey, UTF16ToWide(contents->GetTitle())); NavigationEntry* entry = contents->controller().GetActiveEntry(); if (entry) { if (entry->favicon().is_valid()) - result->SetString(kFavIconUrlKey, entry->favicon().url().spec()); + result->SetString(keys::kFavIconUrlKey, entry->favicon().url().spec()); } } @@ -238,12 +204,12 @@ bool CreateWindowFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY)); const DictionaryValue *args = static_cast<const DictionaryValue*>(args_); std::string url_input; - if (args->HasKey(ExtensionTabUtil::kUrlKey)) { - EXTENSION_FUNCTION_VALIDATE(args->GetString(ExtensionTabUtil::kUrlKey, + if (args->HasKey(keys::kUrlKey)) { + EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kUrlKey, &url_input)); url.reset(new GURL(url_input)); if (!url->is_valid()) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kInvalidUrlError, + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_input); return false; } @@ -264,26 +230,26 @@ bool CreateWindowFunction::RunImpl() { if (args_->IsType(Value::TYPE_DICTIONARY)) { const DictionaryValue *args = static_cast<const DictionaryValue*>(args_); int bounds_val; - if (args->HasKey(ExtensionTabUtil::kLeftKey)) { - EXTENSION_FUNCTION_VALIDATE(args->GetInteger(ExtensionTabUtil::kLeftKey, + if (args->HasKey(keys::kLeftKey)) { + EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kLeftKey, &bounds_val)); bounds.set_x(bounds_val); } - if (args->HasKey(ExtensionTabUtil::kTopKey)) { - EXTENSION_FUNCTION_VALIDATE(args->GetInteger(ExtensionTabUtil::kTopKey, + if (args->HasKey(keys::kTopKey)) { + EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kTopKey, &bounds_val)); bounds.set_y(bounds_val); } - if (args->HasKey(ExtensionTabUtil::kWidthKey)) { - EXTENSION_FUNCTION_VALIDATE(args->GetInteger(ExtensionTabUtil::kWidthKey, + if (args->HasKey(keys::kWidthKey)) { + EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kWidthKey, &bounds_val)); bounds.set_width(bounds_val); } - if (args->HasKey(ExtensionTabUtil::kHeightKey)) { - EXTENSION_FUNCTION_VALIDATE(args->GetInteger(ExtensionTabUtil::kHeightKey, + if (args->HasKey(keys::kHeightKey)) { + EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kHeightKey, &bounds_val)); bounds.set_height(bounds_val); } @@ -318,30 +284,30 @@ bool UpdateWindowFunction::RunImpl() { gfx::Rect bounds = browser->window()->GetNormalBounds(); // Any part of the bounds can optionally be set by the caller. int bounds_val; - if (update_props->HasKey(ExtensionTabUtil::kLeftKey)) { + if (update_props->HasKey(keys::kLeftKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( - ExtensionTabUtil::kLeftKey, + keys::kLeftKey, &bounds_val)); bounds.set_x(bounds_val); } - if (update_props->HasKey(ExtensionTabUtil::kTopKey)) { + if (update_props->HasKey(keys::kTopKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( - ExtensionTabUtil::kTopKey, + keys::kTopKey, &bounds_val)); bounds.set_y(bounds_val); } - if (update_props->HasKey(ExtensionTabUtil::kWidthKey)) { + if (update_props->HasKey(keys::kWidthKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( - ExtensionTabUtil::kWidthKey, + keys::kWidthKey, &bounds_val)); bounds.set_width(bounds_val); } - if (update_props->HasKey(ExtensionTabUtil::kHeightKey)) { + if (update_props->HasKey(keys::kHeightKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( - ExtensionTabUtil::kHeightKey, + keys::kHeightKey, &bounds_val)); bounds.set_height(bounds_val); } @@ -418,9 +384,9 @@ bool CreateTabFunction::RunImpl() { Browser *browser; // windowId defaults to "current" window. int window_id = -1; - if (args->HasKey(ExtensionTabUtil::kWindowIdKey)) { + if (args->HasKey(keys::kWindowIdKey)) { EXTENSION_FUNCTION_VALIDATE(args->GetInteger( - ExtensionTabUtil::kWindowIdKey, &window_id)); + keys::kWindowIdKey, &window_id)); browser = GetBrowserInProfileWithId(profile(), window_id, &error_); if (!browser) return false; @@ -436,15 +402,15 @@ bool CreateTabFunction::RunImpl() { std::string url_string; scoped_ptr<GURL> url(new GURL()); - if (args->HasKey(ExtensionTabUtil::kUrlKey)) { - EXTENSION_FUNCTION_VALIDATE(args->GetString(ExtensionTabUtil::kUrlKey, + if (args->HasKey(keys::kUrlKey)) { + EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kUrlKey, &url_string)); url.reset(new GURL(url_string)); if (!url->is_valid()) { // The path as passed in is not valid. Try converting to absolute path. *url = AbsolutePath(profile(), extension_id(), url_string); if (!url->is_valid()) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kInvalidUrlError, + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string); return false; } @@ -454,14 +420,14 @@ bool CreateTabFunction::RunImpl() { // Default to foreground for the new tab. The presence of 'selected' property // will override this default. bool selected = true; - if (args->HasKey(ExtensionTabUtil::kSelectedKey)) - EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(ExtensionTabUtil::kSelectedKey, + if (args->HasKey(keys::kSelectedKey)) + EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kSelectedKey, &selected)); // If index is specified, honor the value, but keep it bound to // 0 <= index <= tab_strip->count() int index = -1; - if (args->HasKey(ExtensionTabUtil::kIndexKey)) - EXTENSION_FUNCTION_VALIDATE(args->GetInteger(ExtensionTabUtil::kIndexKey, + if (args->HasKey(keys::kIndexKey)) + EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kIndexKey, &index)); if (index < 0) { @@ -522,16 +488,17 @@ bool UpdateTabFunction::RunImpl() { // Navigate the tab to a new location if the url different. std::string url; - if (update_props->HasKey(ExtensionTabUtil::kUrlKey)) { + if (update_props->HasKey(keys::kUrlKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetString( - ExtensionTabUtil::kUrlKey, &url)); + keys::kUrlKey, &url)); GURL new_gurl(url); if (!new_gurl.is_valid()) { // The path as passed in is not valid. Try converting to absolute path. new_gurl = AbsolutePath(profile(), extension_id(), url); if (!new_gurl.is_valid()) { - error_ = ExtensionErrorUtils::FormatErrorMessage(kInvalidUrlError, url); + error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, + url); return false; } } @@ -542,9 +509,9 @@ bool UpdateTabFunction::RunImpl() { bool selected = false; // TODO(rafaelw): Setting |selected| from js doesn't make much sense. // Move tab selection management up to window. - if (update_props->HasKey(ExtensionTabUtil::kSelectedKey)) { + if (update_props->HasKey(keys::kSelectedKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( - ExtensionTabUtil::kSelectedKey, + keys::kSelectedKey, &selected)); if (selected && tab_strip->selected_index() != tab_index) { tab_strip->SelectTabContentsAt(tab_index, false); @@ -564,7 +531,7 @@ bool MoveTabFunction::RunImpl() { int new_index; EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( - ExtensionTabUtil::kIndexKey, &new_index)); + keys::kIndexKey, &new_index)); EXTENSION_FUNCTION_VALIDATE(new_index >= 0); Browser* source_browser = NULL; @@ -574,11 +541,11 @@ bool MoveTabFunction::RunImpl() { &tab_index, &error_)) return false; - if (update_props->HasKey(ExtensionTabUtil::kWindowIdKey)) { + if (update_props->HasKey(keys::kWindowIdKey)) { Browser* target_browser; int window_id; EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( - ExtensionTabUtil::kWindowIdKey, &window_id)); + keys::kWindowIdKey, &window_id)); target_browser = GetBrowserInProfileWithId(profile(), window_id, &error_); if (!target_browser) @@ -591,7 +558,7 @@ bool MoveTabFunction::RunImpl() { TabContents *contents = source_tab_strip->DetachTabContentsAt(tab_index); if (!contents) { error_ = ExtensionErrorUtils::FormatErrorMessage( - kTabNotFoundError, IntToString(tab_id)); + keys::kTabNotFoundError, IntToString(tab_id)); return false; } @@ -640,20 +607,20 @@ bool RemoveTabFunction::RunImpl() { static DictionaryValue* CreateWindowValue(Browser* browser, bool populate_tabs) { DictionaryValue* result = new DictionaryValue(); - result->SetInteger(ExtensionTabUtil::kIdKey, ExtensionTabUtil::GetWindowId( + result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetWindowId( browser)); - result->SetBoolean(ExtensionTabUtil::kFocusedKey, + result->SetBoolean(keys::kFocusedKey, browser->window()->IsActive()); gfx::Rect bounds = browser->window()->GetNormalBounds(); // TODO(rafaelw): zIndex ? - result->SetInteger(ExtensionTabUtil::kLeftKey, bounds.x()); - result->SetInteger(ExtensionTabUtil::kTopKey, bounds.y()); - result->SetInteger(ExtensionTabUtil::kWidthKey, bounds.width()); - result->SetInteger(ExtensionTabUtil::kHeightKey, bounds.height()); + result->SetInteger(keys::kLeftKey, bounds.x()); + result->SetInteger(keys::kTopKey, bounds.y()); + result->SetInteger(keys::kWidthKey, bounds.width()); + result->SetInteger(keys::kHeightKey, bounds.height()); if (populate_tabs) { - result->Set(ExtensionTabUtil::kTabsKey, CreateTabList(browser)); + result->Set(keys::kTabsKey, CreateTabList(browser)); } return result; @@ -682,7 +649,7 @@ static Browser* GetBrowserInProfileWithId(Profile* profile, if (error_message) *error_message= ExtensionErrorUtils::FormatErrorMessage( - kWindowNotFoundError, IntToString(window_id)); + keys::kWindowNotFoundError, IntToString(window_id)); return NULL; } @@ -705,7 +672,7 @@ static bool GetTabById(int tab_id, Profile* profile, Browser** browser, if (error_message) *error_message = ExtensionErrorUtils::FormatErrorMessage( - kTabNotFoundError, IntToString(tab_id)); + keys::kTabNotFoundError, IntToString(tab_id)); return false; } diff --git a/chrome/browser/extensions/extension_tabs_module.h b/chrome/browser/extensions/extension_tabs_module.h index 7e27e37..cb8b3d3 100644 --- a/chrome/browser/extensions/extension_tabs_module.h +++ b/chrome/browser/extensions/extension_tabs_module.h @@ -23,36 +23,6 @@ class ExtensionTabUtil { TAB_COMPLETE // Tab loading and rendering is complete. }; - // Keys used in serializing tab data & events. - static const wchar_t* kDataKey; - static const wchar_t* kFavIconUrlKey; - static const wchar_t* kFocusedKey; - static const wchar_t* kFromIndexKey; - static const wchar_t* kHeightKey; - static const wchar_t* kIdKey; - static const wchar_t* kIndexKey; - static const wchar_t* kLeftKey; - static const wchar_t* kNewPositionKey; - static const wchar_t* kNewWindowIdKey; - static const wchar_t* kOldPositionKey; - static const wchar_t* kOldWindowIdKey; - static const wchar_t* kPageActionIdKey; - static const wchar_t* kSelectedKey; - static const wchar_t* kStatusKey; - static const wchar_t* kTabIdKey; - static const wchar_t* kTabsKey; - static const wchar_t* kTabUrlKey; - static const wchar_t* kTitleKey; - static const wchar_t* kToIndexKey; - static const wchar_t* kTopKey; - static const wchar_t* kUrlKey; - static const wchar_t* kWidthKey; - static const wchar_t* kWindowIdKey; - - // Value consts. - static const char* kStatusValueComplete; - static const char* kStatusValueLoading; - static int GetWindowId(const Browser* browser); static int GetTabId(const TabContents* tab_contents); static TabStatus GetTabStatus(const TabContents* tab_contents); diff --git a/chrome/browser/extensions/extension_tabs_module_constants.cc b/chrome/browser/extensions/extension_tabs_module_constants.cc new file mode 100755 index 0000000..bf5e728 --- /dev/null +++ b/chrome/browser/extensions/extension_tabs_module_constants.cc @@ -0,0 +1,58 @@ +// Copyright (c) 2009 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/extension_tabs_module_constants.h" + +namespace extension_tabs_module_constants { + +const wchar_t kDataKey[] = L"data"; +const wchar_t kFavIconUrlKey[] = L"favIconUrl"; +const wchar_t kFocusedKey[] = L"focused"; +const wchar_t kFromIndexKey[] = L"fromIndex"; +const wchar_t kHeightKey[] = L"height"; +const wchar_t kIdKey[] = L"id"; +const wchar_t kIndexKey[] = L"index"; +const wchar_t kLeftKey[] = L"left"; +const wchar_t kNewPositionKey[] = L"newPosition"; +const wchar_t kNewWindowIdKey[] = L"newWindowId"; +const wchar_t kOldPositionKey[] = L"oldPosition"; +const wchar_t kOldWindowIdKey[] = L"oldWindowId"; +const wchar_t kPageActionIdKey[] = L"pageActionId"; +const wchar_t kSelectedKey[] = L"selected"; +const wchar_t kStatusKey[] = L"status"; +const wchar_t kTabIdKey[] = L"tabId"; +const wchar_t kTabsKey[] = L"tabs"; +const wchar_t kTabUrlKey[] = L"tabUrl"; +const wchar_t kTitleKey[] = L"title"; +const wchar_t kToIndexKey[] = L"toIndex"; +const wchar_t kTopKey[] = L"top"; +const wchar_t kUrlKey[] = L"url"; +const wchar_t kWidthKey[] = L"width"; +const wchar_t kWindowIdKey[] = L"windowId"; + +const char kStatusValueComplete[] = "complete"; +const char kStatusValueLoading[] = "loading"; + +const char kWindowNotFoundError[] = "No window with id: *."; +const char kTabNotFoundError[] = "No tab with id: *."; +const char kInvalidUrlError[] = "Invalid url: \"*\"."; + +const char kGetWindowFunction[] = "GetWindow"; +const char kGetCurrentWindowFunction[] = "GetCurrentWindow"; +const char kGetLastFocusedWindowFunction[] = "GetLastFocusedWindow"; +const char kGetAllWindowsFunction[] = "GetAllWindows"; +const char kCreateWindowFunction[] = "CreateWindow"; +const char kUpdateWindowFunction[] = "UpdateWindow"; +const char kRemoveWindowFunction[] = "RemoveWindow"; + +const char kGetTabFunction[] = "GetTab"; +const char kGetSelectedTabFunction[] = "GetSelectedTab"; +const char kGetAllTabsInWindowFunction[] = "GetAllTabsInWindow"; +const char kCreateTabFunction[] = "CreateTab"; +const char kUpdateTabFunction[] = "UpdateTab"; +const char kMoveTabFunction[] = "MoveTab"; +const char kRemoveTabFunction[] = "RemoveTab"; + + +} // namespace extension_tabs_module_constants diff --git a/chrome/browser/extensions/extension_tabs_module_constants.h b/chrome/browser/extensions/extension_tabs_module_constants.h new file mode 100755 index 0000000..a990c5c --- /dev/null +++ b/chrome/browser/extensions/extension_tabs_module_constants.h @@ -0,0 +1,67 @@ +// Copyright (c) 2009 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. + +// Constants used for the Tabs API and the Windows API. + +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_CONSTANTS_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_CONSTANTS_H_ + +namespace extension_tabs_module_constants { + +// Keys used in serializing tab data & events. +extern const wchar_t kDataKey[]; +extern const wchar_t kFavIconUrlKey[]; +extern const wchar_t kFocusedKey[]; +extern const wchar_t kFromIndexKey[]; +extern const wchar_t kHeightKey[]; +extern const wchar_t kIdKey[]; +extern const wchar_t kIndexKey[]; +extern const wchar_t kLeftKey[]; +extern const wchar_t kNewPositionKey[]; +extern const wchar_t kNewWindowIdKey[]; +extern const wchar_t kOldPositionKey[]; +extern const wchar_t kOldWindowIdKey[]; +extern const wchar_t kPageActionIdKey[]; +extern const wchar_t kSelectedKey[]; +extern const wchar_t kStatusKey[]; +extern const wchar_t kTabIdKey[]; +extern const wchar_t kTabsKey[]; +extern const wchar_t kTabUrlKey[]; +extern const wchar_t kTitleKey[]; +extern const wchar_t kToIndexKey[]; +extern const wchar_t kTopKey[]; +extern const wchar_t kUrlKey[]; +extern const wchar_t kWidthKey[]; +extern const wchar_t kWindowIdKey[]; + +// Value consts. +extern const char kStatusValueComplete[]; +extern const char kStatusValueLoading[]; + +// Error messages. +extern const char kWindowNotFoundError[]; +extern const char kTabNotFoundError[]; +extern const char kInvalidUrlError[]; + +// Function names, Windows API. +extern const char kGetWindowFunction[]; +extern const char kGetCurrentWindowFunction[]; +extern const char kGetLastFocusedWindowFunction[]; +extern const char kGetAllWindowsFunction[]; +extern const char kCreateWindowFunction[]; +extern const char kUpdateWindowFunction[]; +extern const char kRemoveWindowFunction[]; + +// Function names, Tabs API. +extern const char kGetTabFunction[]; +extern const char kGetSelectedTabFunction[]; +extern const char kGetAllTabsInWindowFunction[]; +extern const char kCreateTabFunction[]; +extern const char kUpdateTabFunction[]; +extern const char kMoveTabFunction[]; +extern const char kRemoveTabFunction[]; + +}; // namespace extension_tabs_module_constants + +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_CONSTANTS_H_ diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 863390a..2f46a76 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -810,10 +810,14 @@ 'browser/extensions/extension.h', 'browser/extensions/extension_bookmarks_module.cc', 'browser/extensions/extension_bookmarks_module.h', + 'browser/extensions/extension_bookmarks_module_constants.cc', + 'browser/extensions/extension_bookmarks_module_constants.h', 'browser/extensions/extension_error_reporter.cc', 'browser/extensions/extension_error_reporter.h', 'browser/extensions/extension_error_utils.cc', 'browser/extensions/extension_error_utils.h', + 'browser/extensions/extension_event_names.cc', + 'browser/extensions/extension_event_names.h', 'browser/extensions/extension_function.cc', 'browser/extensions/extension_function.h', 'browser/extensions/extension_function_dispatcher.cc', @@ -824,8 +828,10 @@ 'browser/extensions/extension_message_service.h', 'browser/extensions/extension_browser_event_router.cc', 'browser/extensions/extension_browser_event_router.h', - 'browser/extensions/extension_page_actions_module.h', 'browser/extensions/extension_page_actions_module.cc', + 'browser/extensions/extension_page_actions_module.h', + 'browser/extensions/extension_page_actions_module_constants.cc', + 'browser/extensions/extension_page_actions_module_constants.h', 'browser/extensions/extension_process_manager.cc', 'browser/extensions/extension_process_manager.h', 'browser/extensions/extension_protocols.cc', @@ -834,6 +840,8 @@ 'browser/extensions/extension_shelf.h', 'browser/extensions/extension_tabs_module.cc', 'browser/extensions/extension_tabs_module.h', + 'browser/extensions/extension_tabs_module_constants.cc', + 'browser/extensions/extension_tabs_module_constants.h', 'browser/extensions/extension_view.cc', 'browser/extensions/extension_view.h', 'browser/extensions/extensions_service.cc', |