diff options
8 files changed, 28 insertions, 24 deletions
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index 1fcb3e7..5a31978 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -61,7 +61,7 @@ DictionaryValue* ExtensionBrowserEventRouter::TabEntry::UpdateLoadState( DictionaryValue* ExtensionBrowserEventRouter::TabEntry::DidNavigate( const TabContents* contents) { - if(!pending_navigate_) + if (!pending_navigate_) return NULL; DictionaryValue* changed_properties = new DictionaryValue(); @@ -226,7 +226,7 @@ void ExtensionBrowserEventRouter::TabClosingAt(TabContents* contents, DispatchEvent(contents->profile(), events::kOnTabRemoved, json_args); int removed_count = tab_entries_.erase(tab_id); - DCHECK(removed_count > 0); + DCHECK_GT(removed_count, 0); registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, Source<NavigationController>(&contents->controller())); @@ -330,11 +330,12 @@ void ExtensionBrowserEventRouter::TabChangedAt(TabContents* contents, void ExtensionBrowserEventRouter::TabStripEmpty() { } -void ExtensionBrowserEventRouter::PageActionExecuted(Profile* profile, - std::string extension_id, - std::string page_action_id, - int tab_id, - std::string url) { +void ExtensionBrowserEventRouter::PageActionExecuted( + Profile* profile, + const std::string& extension_id, + const std::string& page_action_id, + int tab_id, + const std::string& url) { ListValue args; DictionaryValue* object_args = new DictionaryValue(); object_args->Set(tab_keys::kPageActionIdKey, diff --git a/chrome/browser/extensions/extension_browser_event_router.h b/chrome/browser/extensions/extension_browser_event_router.h index d2f7613..059fae3 100644 --- a/chrome/browser/extensions/extension_browser_event_router.h +++ b/chrome/browser/extensions/extension_browser_event_router.h @@ -50,10 +50,10 @@ class ExtensionBrowserEventRouter : public TabStripModelObserver, // PageActions. void PageActionExecuted(Profile* profile, - std::string extension_id, - std::string page_action_id, + const std::string& extension_id, + const std::string& page_action_id, int tab_id, - std::string url); + const std::string& url); // NotificationObserver. void Observe(NotificationType type, diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 2b1492d..a9fff40 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -80,7 +80,7 @@ class MockExtensionProvider : public ExternalExtensionProvider { void UpdateOrAddExtension(const std::string& id, const std::string& version, - FilePath path) { + const FilePath& path) { extension_map_[id] = std::make_pair(version, path); } @@ -103,7 +103,7 @@ class MockExtensionProvider : public ExternalExtensionProvider { } } - virtual Version* RegisteredVersion(std::string id, + virtual Version* RegisteredVersion(const std::string& id, Extension::Location* location) const { DataMap::const_iterator it = extension_map_.find(id); if (it == extension_map_.end()) @@ -127,7 +127,8 @@ class MockProviderVisitor : public ExternalExtensionProvider::Visitor { MockProviderVisitor() { } - int Visit(std::string json_data, const std::set<std::string>& ignore_list) { + int Visit(const std::string& json_data, + const std::set<std::string>& ignore_list) { // Give the test json file to the provider for parsing. provider_.reset(new ExternalPrefExtensionProvider()); provider_->SetPreferencesForTesting(json_data); @@ -415,8 +416,8 @@ class ExtensionsServiceTest EXPECT_EQ(count, dict->GetSize()); } - void ValidatePref(std::string extension_id, - std::wstring pref_path, + void ValidatePref(const std::string& extension_id, + const std::wstring& pref_path, int must_equal) { std::wstring msg = L" while checking: "; msg += ASCIIToWide(extension_id); @@ -436,7 +437,9 @@ class ExtensionsServiceTest EXPECT_EQ(must_equal, val) << msg; } - void SetPref(std::string extension_id, std::wstring pref_path, int value) { + void SetPref(const std::string& extension_id, + const std::wstring& pref_path, + int value) { std::wstring msg = L" while setting: "; msg += ASCIIToWide(extension_id); msg += L" "; @@ -468,7 +471,7 @@ class ExtensionsServiceTest NotificationRegistrar registrar_; }; -FilePath::StringType NormalizeSeperators(FilePath::StringType path) { +FilePath::StringType NormalizeSeperators(const FilePath::StringType& path) { #if defined(FILE_PATH_USES_WIN_SEPARATORS) FilePath::StringType ret_val; for (size_t i = 0; i < path.length(); i++) { diff --git a/chrome/browser/extensions/external_extension_provider.h b/chrome/browser/extensions/external_extension_provider.h index dafa665..d67a918 100644 --- a/chrome/browser/extensions/external_extension_provider.h +++ b/chrome/browser/extensions/external_extension_provider.h @@ -39,7 +39,7 @@ class ExternalExtensionProvider { // Gets the version of extension with |id| and its |location|. |location| can // be NULL. The caller is responsible for cleaning up the Version object // returned. This function returns NULL if the extension is not found. - virtual Version* RegisteredVersion(std::string id, + virtual Version* RegisteredVersion(const std::string& id, Extension::Location* location) const = 0; }; diff --git a/chrome/browser/extensions/external_pref_extension_provider.cc b/chrome/browser/extensions/external_pref_extension_provider.cc index cc4b031..f2ea35a 100644 --- a/chrome/browser/extensions/external_pref_extension_provider.cc +++ b/chrome/browser/extensions/external_pref_extension_provider.cc @@ -31,7 +31,7 @@ ExternalPrefExtensionProvider::~ExternalPrefExtensionProvider() { } void ExternalPrefExtensionProvider::SetPreferencesForTesting( - std::string json_data_for_testing) { + const std::string& json_data_for_testing) { JSONStringValueSerializer serializer(json_data_for_testing); SetPreferences(&serializer); } @@ -81,7 +81,7 @@ void ExternalPrefExtensionProvider::VisitRegisteredExtension( } Version* ExternalPrefExtensionProvider::RegisteredVersion( - std::string id, Extension::Location* location) const { + const std::string& id, Extension::Location* location) const { DictionaryValue* extension = NULL; if (!prefs_->GetDictionary(ASCIIToWide(id), &extension)) return NULL; diff --git a/chrome/browser/extensions/external_pref_extension_provider.h b/chrome/browser/extensions/external_pref_extension_provider.h index 67d46e3..0b222b5 100644 --- a/chrome/browser/extensions/external_pref_extension_provider.h +++ b/chrome/browser/extensions/external_pref_extension_provider.h @@ -22,13 +22,13 @@ class ExternalPrefExtensionProvider : public ExternalExtensionProvider { // Used only during testing to not use the json file for external extensions, // but instead parse a json file specified by the test. - void SetPreferencesForTesting(std::string json_data_for_testing); + void SetPreferencesForTesting(const std::string& json_data_for_testing); // ExternalExtensionProvider implementation: virtual void VisitRegisteredExtension( Visitor* visitor, const std::set<std::string>& ids_to_ignore) const; - virtual Version* RegisteredVersion(std::string id, + virtual Version* RegisteredVersion(const std::string& id, Extension::Location* location) const; protected: scoped_ptr<DictionaryValue> prefs_; diff --git a/chrome/browser/extensions/external_registry_extension_provider_win.cc b/chrome/browser/extensions/external_registry_extension_provider_win.cc index f820be4..3809eb4 100644 --- a/chrome/browser/extensions/external_registry_extension_provider_win.cc +++ b/chrome/browser/extensions/external_registry_extension_provider_win.cc @@ -68,7 +68,7 @@ void ExternalRegistryExtensionProvider::VisitRegisteredExtension( } Version* ExternalRegistryExtensionProvider::RegisteredVersion( - std::string id, + const std::string& id, Extension::Location* location) const { RegKey key; std::wstring key_path = ASCIIToWide(kRegistryExtensions); diff --git a/chrome/browser/extensions/external_registry_extension_provider_win.h b/chrome/browser/extensions/external_registry_extension_provider_win.h index 88f472f..39b3a15 100644 --- a/chrome/browser/extensions/external_registry_extension_provider_win.h +++ b/chrome/browser/extensions/external_registry_extension_provider_win.h @@ -23,7 +23,7 @@ class ExternalRegistryExtensionProvider : public ExternalExtensionProvider { virtual void VisitRegisteredExtension( Visitor* visitor, const std::set<std::string>& ids_to_ignore) const; - virtual Version* RegisteredVersion(std::string id, + virtual Version* RegisteredVersion(const std::string& id, Extension::Location* location) const; }; |