summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorlimasdf@gmail.com <limasdf@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 21:39:18 +0000
committerlimasdf@gmail.com <limasdf@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 21:39:18 +0000
commit0bb29bdceb67aab9bb19599380938d2cd6f60306 (patch)
tree31d0cf193a376cc923df2069c39c0e8c292b0d4a /chrome
parentf32f8dc82e312385ed388267e5606c56110dc726 (diff)
downloadchromium_src-0bb29bdceb67aab9bb19599380938d2cd6f60306.zip
chromium_src-0bb29bdceb67aab9bb19599380938d2cd6f60306.tar.gz
chromium_src-0bb29bdceb67aab9bb19599380938d2cd6f60306.tar.bz2
cleanup: pass string as const reference from c/b/extension
BUG=367418 Review URL: https://codereview.chromium.org/257803002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267343 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/app_process_apitest.cc4
-rw-r--r--chrome/browser/extensions/app_sync_bundle.cc2
-rw-r--r--chrome/browser/extensions/app_sync_bundle.h4
-rw-r--r--chrome/browser/extensions/extension_context_menu_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extension_crash_recovery_browsertest.cc22
-rw-r--r--chrome/browser/extensions/extension_prefs_unittest.cc4
-rw-r--r--chrome/browser/extensions/extension_service.cc7
-rw-r--r--chrome/browser/extensions/extension_service.h2
-rw-r--r--chrome/browser/extensions/extension_test_notification_observer.h3
-rw-r--r--chrome/browser/extensions/gtalk_extension_browsertest.cc2
-rw-r--r--chrome/browser/extensions/menu_manager_unittest.cc2
-rw-r--r--chrome/browser/extensions/test_extension_prefs.cc8
-rw-r--r--chrome/browser/extensions/test_extension_prefs.h6
-rw-r--r--chrome/browser/extensions/updater/manifest_fetch_data.cc6
-rw-r--r--chrome/browser/extensions/updater/manifest_fetch_data.h5
-rw-r--r--chrome/browser/extensions/user_script_master.cc2
-rw-r--r--chrome/browser/extensions/user_script_master.h2
17 files changed, 45 insertions, 38 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 235b11d..af6e337 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -46,7 +46,7 @@ class AppApiTest : public ExtensionApiTest {
// Gets the base URL for files for a specific test, making sure that it uses
// "localhost" as the hostname, since that is what the extent is declared
// as in the test apps manifests.
- GURL GetTestBaseURL(std::string test_directory) {
+ GURL GetTestBaseURL(const std::string& test_directory) {
GURL::Replacements replace_host;
std::string host_str("localhost"); // must stay in scope with replace_host
replace_host.SetHostStr(host_str);
@@ -66,7 +66,7 @@ class AppApiTest : public ExtensionApiTest {
// Helper function to test that independent tabs of the named app are loaded
// into separate processes.
- void TestAppInstancesHelper(std::string app_name) {
+ void TestAppInstancesHelper(const std::string& app_name) {
LOG(INFO) << "Start of test.";
extensions::ProcessMap* process_map =
diff --git a/chrome/browser/extensions/app_sync_bundle.cc b/chrome/browser/extensions/app_sync_bundle.cc
index e87bd14..33a397d 100644
--- a/chrome/browser/extensions/app_sync_bundle.cc
+++ b/chrome/browser/extensions/app_sync_bundle.cc
@@ -51,7 +51,7 @@ syncer::SyncChange AppSyncBundle::CreateSyncChangeToDelete(
return sync_data.GetSyncChange(syncer::SyncChange::ACTION_DELETE);
}
-void AppSyncBundle::ProcessDeletion(std::string extension_id,
+void AppSyncBundle::ProcessDeletion(const std::string& extension_id,
const syncer::SyncChange& sync_change) {
RemoveApp(extension_id);
sync_processor_->ProcessSyncChanges(FROM_HERE,
diff --git a/chrome/browser/extensions/app_sync_bundle.h b/chrome/browser/extensions/app_sync_bundle.h
index 11e0dd9..f917d8f 100644
--- a/chrome/browser/extensions/app_sync_bundle.h
+++ b/chrome/browser/extensions/app_sync_bundle.h
@@ -47,8 +47,8 @@ class AppSyncBundle : public SyncBundle {
syncer::SyncChange CreateSyncChangeToDelete(const Extension* extension) const;
// Process the sync deletion of the given application.
- void ProcessDeletion(
- std::string extension_id, const syncer::SyncChange& sync_change);
+ void ProcessDeletion(const std::string& extension_id,
+ const syncer::SyncChange& sync_change);
// Create a sync change based on |sync_data|.
syncer::SyncChange CreateSyncChange(const syncer::SyncData& sync_data);
diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc
index 3859a78..8891138 100644
--- a/chrome/browser/extensions/extension_context_menu_browsertest.cc
+++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc
@@ -66,7 +66,7 @@ class ExtensionContextMenuBrowserTest : public ExtensionBrowserTest {
// Returns a pointer to the currently loaded extension with |name|, or null
// if not found.
- const extensions::Extension* GetExtensionNamed(std::string name) {
+ const extensions::Extension* GetExtensionNamed(const std::string& name) {
const extensions::ExtensionSet* extensions =
browser()->profile()->GetExtensionService()->extensions();
for (extensions::ExtensionSet::const_iterator i = extensions->begin();
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index b68e786..cccf918 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -54,19 +54,21 @@ class ExtensionCrashRecoveryTestBase : public ExtensionBrowserTest {
process_manager();
}
+ ExtensionRegistry* GetExtensionRegistry() {
+ return ExtensionRegistry::Get(browser()->profile());
+ }
+
size_t GetEnabledExtensionCount() {
- ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
- return registry->enabled_extensions().size();
+ return GetExtensionRegistry()->enabled_extensions().size();
}
size_t GetTerminatedExtensionCount() {
- ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
- return registry->terminated_extensions().size();
+ return GetExtensionRegistry()->terminated_extensions().size();
}
- void CrashExtension(std::string extension_id) {
- const Extension* extension =
- GetExtensionService()->GetExtensionById(extension_id, false);
+ void CrashExtension(const std::string& extension_id) {
+ const Extension* extension = GetExtensionRegistry()->GetExtensionById(
+ extension_id, ExtensionRegistry::ENABLED);
ASSERT_TRUE(extension);
extensions::ExtensionHost* extension_host = GetProcessManager()->
GetBackgroundHostForExtension(extension_id);
@@ -82,9 +84,9 @@ class ExtensionCrashRecoveryTestBase : public ExtensionBrowserTest {
base::MessageLoop::current()->RunUntilIdle();
}
- void CheckExtensionConsistency(std::string extension_id) {
- const Extension* extension =
- GetExtensionService()->extensions()->GetByID(extension_id);
+ void CheckExtensionConsistency(const std::string& extension_id) {
+ const Extension* extension = GetExtensionRegistry()->GetExtensionById(
+ extension_id, ExtensionRegistry::ENABLED);
ASSERT_TRUE(extension);
extensions::ExtensionHost* extension_host = GetProcessManager()->
GetBackgroundHostForExtension(extension_id);
diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc
index 9067ed4..9292f63 100644
--- a/chrome/browser/extensions/extension_prefs_unittest.cc
+++ b/chrome/browser/extensions/extension_prefs_unittest.cc
@@ -471,7 +471,7 @@ TEST_F(ExtensionPrefsAcknowledgment, Acknowledgment) {}
class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest {
public:
// Sets idle install information for one test extension.
- void SetIdleInfo(std::string id, int num) {
+ void SetIdleInfo(const std::string& id, int num) {
base::DictionaryValue manifest;
manifest.SetString(manifest_keys::kName, "test");
manifest.SetString(manifest_keys::kVersion, "1." + base::IntToString(num));
@@ -492,7 +492,7 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest {
// Verifies that we get back expected idle install information previously
// set by SetIdleInfo.
- void VerifyIdleInfo(std::string id, int num) {
+ void VerifyIdleInfo(const std::string& id, int num) {
scoped_ptr<ExtensionInfo> info(prefs()->GetDelayedInstallInfo(id));
ASSERT_TRUE(info);
std::string version;
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index ac49c1d..c17fae0 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -662,10 +662,9 @@ void ExtensionService::ReloadExtension(const std::string extension_id) {
SetBeingReloaded(extension_id, false);
}
-bool ExtensionService::UninstallExtension(
- std::string extension_id,
- bool external_uninstall,
- base::string16* error) {
+bool ExtensionService::UninstallExtension(const std::string& extension_id,
+ bool external_uninstall,
+ base::string16* error) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
scoped_refptr<const Extension> extension(GetInstalledExtension(extension_id));
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 20e50af..03f18a1 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -206,7 +206,7 @@ class ExtensionService
//
// TODO(aa): Remove |external_uninstall| -- this information should be passed
// to ExtensionPrefs some other way.
- virtual bool UninstallExtension(std::string extension_id,
+ virtual bool UninstallExtension(const std::string& extension_id,
bool external_uninstall,
base::string16* error);
diff --git a/chrome/browser/extensions/extension_test_notification_observer.h b/chrome/browser/extensions/extension_test_notification_observer.h
index 14636b6..55e16da 100644
--- a/chrome/browser/extensions/extension_test_notification_observer.h
+++ b/chrome/browser/extensions/extension_test_notification_observer.h
@@ -71,7 +71,8 @@ class ExtensionTestNotificationObserver : public content::NotificationObserver {
const std::string& last_loaded_extension_id() {
return last_loaded_extension_id_;
}
- void set_last_loaded_extension_id(std::string last_loaded_extension_id) {
+ void set_last_loaded_extension_id(
+ const std::string& last_loaded_extension_id) {
last_loaded_extension_id_ = last_loaded_extension_id;
}
diff --git a/chrome/browser/extensions/gtalk_extension_browsertest.cc b/chrome/browser/extensions/gtalk_extension_browsertest.cc
index 177ad98..8217b48 100644
--- a/chrome/browser/extensions/gtalk_extension_browsertest.cc
+++ b/chrome/browser/extensions/gtalk_extension_browsertest.cc
@@ -53,7 +53,7 @@ class GtalkExtensionTest : public ExtensionBrowserTest {
return "chrome-extension://" + GetInstalledExtensionId() + "/viewer.html";
}
- std::vector<RenderViewHost*> GetMatchingViews(std::string url_query) {
+ std::vector<RenderViewHost*> GetMatchingViews(const std::string& url_query) {
extensions::ProcessManager* manager = GetProcessManager();
extensions::ProcessManager::ViewSet all_views = manager->GetAllViews();
std::vector<RenderViewHost*> matching_views;
diff --git a/chrome/browser/extensions/menu_manager_unittest.cc b/chrome/browser/extensions/menu_manager_unittest.cc
index 486c973..284f549 100644
--- a/chrome/browser/extensions/menu_manager_unittest.cc
+++ b/chrome/browser/extensions/menu_manager_unittest.cc
@@ -83,7 +83,7 @@ class MenuManagerTest : public testing::Test {
// Creates and returns a test Extension. The caller does *not* own the return
// value.
- Extension* AddExtension(std::string name) {
+ Extension* AddExtension(const std::string& name) {
scoped_refptr<Extension> extension = prefs_.AddExtension(name);
extensions_.push_back(extension);
return extension.get();
diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc
index dbb45327..6ea55b7 100644
--- a/chrome/browser/extensions/test_extension_prefs.cc
+++ b/chrome/browser/extensions/test_extension_prefs.cc
@@ -123,14 +123,15 @@ void TestExtensionPrefs::RecreateExtensionPrefs() {
scoped_ptr<ExtensionPrefs::TimeProvider>(new IncrementalTimeProvider())));
}
-scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) {
+scoped_refptr<Extension> TestExtensionPrefs::AddExtension(
+ const std::string& name) {
base::DictionaryValue dictionary;
dictionary.SetString(manifest_keys::kName, name);
dictionary.SetString(manifest_keys::kVersion, "0.1");
return AddExtensionWithManifest(dictionary, Manifest::INTERNAL);
}
-scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) {
+scoped_refptr<Extension> TestExtensionPrefs::AddApp(const std::string& name) {
base::DictionaryValue dictionary;
dictionary.SetString(manifest_keys::kName, name);
dictionary.SetString(manifest_keys::kVersion, "0.1");
@@ -169,7 +170,8 @@ scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifestAndFlags(
return extension;
}
-std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) {
+std::string TestExtensionPrefs::AddExtensionAndReturnId(
+ const std::string& name) {
scoped_refptr<Extension> extension(AddExtension(name));
return extension->id();
}
diff --git a/chrome/browser/extensions/test_extension_prefs.h b/chrome/browser/extensions/test_extension_prefs.h
index 6232089..4dad1fb 100644
--- a/chrome/browser/extensions/test_extension_prefs.h
+++ b/chrome/browser/extensions/test_extension_prefs.h
@@ -55,10 +55,10 @@ class TestExtensionPrefs {
// Creates a new Extension with the given name in our temp dir, adds it to
// our ExtensionPrefs, and returns it.
- scoped_refptr<Extension> AddExtension(std::string name);
+ scoped_refptr<Extension> AddExtension(const std::string& name);
// As above, but the extension is an app.
- scoped_refptr<Extension> AddApp(std::string name);
+ scoped_refptr<Extension> AddApp(const std::string& name);
// Similar to AddExtension, but takes a dictionary with manifest values.
scoped_refptr<Extension> AddExtensionWithManifest(
@@ -75,7 +75,7 @@ class TestExtensionPrefs {
// Similar to AddExtension, this adds a new test Extension. This is useful for
// cases when you don't need the Extension object, but just the id it was
// assigned.
- std::string AddExtensionAndReturnId(std::string name);
+ std::string AddExtensionAndReturnId(const std::string& name);
PrefService* CreateIncognitoPrefService() const;
diff --git a/chrome/browser/extensions/updater/manifest_fetch_data.cc b/chrome/browser/extensions/updater/manifest_fetch_data.cc
index f780e189..3144afc 100644
--- a/chrome/browser/extensions/updater/manifest_fetch_data.cc
+++ b/chrome/browser/extensions/updater/manifest_fetch_data.cc
@@ -62,7 +62,8 @@ ManifestFetchData::~ManifestFetchData() {}
// http://somehost/path?x=id%3Daaaa%26v%3D1.1%26uc&x=id%3Dbbbb%26v%3D2.0%26uc
//
// (Note that '=' is %3D and '&' is %26 when urlencoded.)
-bool ManifestFetchData::AddExtension(std::string id, std::string version,
+bool ManifestFetchData::AddExtension(const std::string& id,
+ const std::string& version,
const PingData* ping_data,
const std::string& update_url_data,
const std::string& install_source) {
@@ -141,7 +142,8 @@ bool ManifestFetchData::Includes(const std::string& extension_id) const {
return extension_ids_.find(extension_id) != extension_ids_.end();
}
-bool ManifestFetchData::DidPing(std::string extension_id, PingType type) const {
+bool ManifestFetchData::DidPing(const std::string& extension_id,
+ PingType type) const {
std::map<std::string, PingData>::const_iterator i = pings_.find(extension_id);
if (i == pings_.end())
return false;
diff --git a/chrome/browser/extensions/updater/manifest_fetch_data.h b/chrome/browser/extensions/updater/manifest_fetch_data.h
index 744299b..926b2d4 100644
--- a/chrome/browser/extensions/updater/manifest_fetch_data.h
+++ b/chrome/browser/extensions/updater/manifest_fetch_data.h
@@ -52,7 +52,8 @@ class ManifestFetchData {
// Returns true if this extension information was successfully added. If the
// return value is false it means the full_url would have become too long, and
// this ManifestFetchData object remains unchanged.
- bool AddExtension(std::string id, std::string version,
+ bool AddExtension(const std::string& id,
+ const std::string& version,
const PingData* ping_data,
const std::string& update_url_data,
const std::string& install_source);
@@ -67,7 +68,7 @@ class ManifestFetchData {
// Returns true if a ping parameter for |type| was added to full_url for this
// extension id.
- bool DidPing(std::string extension_id, PingType type) const;
+ bool DidPing(const std::string& extension_id, PingType type) const;
// Assuming that both this ManifestFetchData and |other| have the same
// full_url, this method merges the other information associated with the
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 3058648..e04d7af 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -242,7 +242,7 @@ void UserScriptMaster::ScriptReloader::LoadUserScripts(
}
SubstitutionMap* UserScriptMaster::ScriptReloader::GetLocalizationMessages(
- std::string extension_id) {
+ const std::string& extension_id) {
if (extensions_info_.find(extension_id) == extensions_info_.end()) {
return NULL;
}
diff --git a/chrome/browser/extensions/user_script_master.h b/chrome/browser/extensions/user_script_master.h
index a7f9172..91fd3ed 100644
--- a/chrome/browser/extensions/user_script_master.h
+++ b/chrome/browser/extensions/user_script_master.h
@@ -113,7 +113,7 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>,
// Uses extensions_info_ to build a map of localization messages.
// Returns NULL if |extension_id| is invalid.
- SubstitutionMap* GetLocalizationMessages(std::string extension_id);
+ SubstitutionMap* GetLocalizationMessages(const std::string& extension_id);
// A pointer back to our master.
// May be NULL if DisownMaster() is called.