Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/browser/extensions/extension_system.cc

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_system.h" 5 #include "chrome/browser/extensions/extension_system.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/string_tokenizer.h" 11 #include "base/strings/string_tokenizer.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/content_settings/cookie_settings.h" 13 #include "chrome/browser/content_settings/cookie_settings.h"
14 #include "chrome/browser/extensions/api/alarms/alarm_manager.h" 14 #include "chrome/browser/extensions/api/alarms/alarm_manager.h"
15 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" 15 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
16 #include "chrome/browser/extensions/api/messaging/message_service.h" 16 #include "chrome/browser/extensions/api/messaging/message_service.h"
17 #include "chrome/browser/extensions/blacklist.h" 17 #include "chrome/browser/extensions/blacklist.h"
18 #include "chrome/browser/extensions/component_loader.h" 18 #include "chrome/browser/extensions/component_loader.h"
19 #include "chrome/browser/extensions/event_router.h" 19 #include "chrome/browser/extensions/event_router.h"
20 #include "chrome/browser/extensions/extension_error_reporter.h" 20 #include "chrome/browser/extensions/extension_error_reporter.h"
21 #include "chrome/browser/extensions/extension_info_map.h" 21 #include "chrome/browser/extensions/extension_info_map.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool skip_session_extensions = false; 161 bool skip_session_extensions = false;
162 #if defined(OS_CHROMEOS) 162 #if defined(OS_CHROMEOS)
163 // Skip loading session extensions if we are not in a user session. 163 // Skip loading session extensions if we are not in a user session.
164 skip_session_extensions = !chromeos::UserManager::Get()->IsUserLoggedIn(); 164 skip_session_extensions = !chromeos::UserManager::Get()->IsUserLoggedIn();
165 #endif 165 #endif
166 extension_service_->component_loader()->AddDefaultComponentExtensions( 166 extension_service_->component_loader()->AddDefaultComponentExtensions(
167 skip_session_extensions); 167 skip_session_extensions);
168 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { 168 if (command_line->HasSwitch(switches::kLoadComponentExtension)) {
169 CommandLine::StringType path_list = command_line->GetSwitchValueNative( 169 CommandLine::StringType path_list = command_line->GetSwitchValueNative(
170 switches::kLoadComponentExtension); 170 switches::kLoadComponentExtension);
171 StringTokenizerT<CommandLine::StringType, 171 base::StringTokenizerT<CommandLine::StringType,
172 CommandLine::StringType::const_iterator> t(path_list, 172 CommandLine::StringType::const_iterator> t(path_list,
173 FILE_PATH_LITERAL(",")); 173 FILE_PATH_LITERAL(","));
174 while (t.GetNext()) { 174 while (t.GetNext()) {
175 // Load the component extension manifest synchronously. 175 // Load the component extension manifest synchronously.
176 // Blocking the UI thread is acceptable here since 176 // Blocking the UI thread is acceptable here since
177 // this flag designated for developers. 177 // this flag designated for developers.
178 base::ThreadRestrictions::ScopedAllowIO allow_io; 178 base::ThreadRestrictions::ScopedAllowIO allow_io;
179 extension_service_->component_loader()->AddOrReplace( 179 extension_service_->component_loader()->AddOrReplace(
180 FilePath(t.token())); 180 FilePath(t.token()));
181 } 181 }
182 } 182 }
183 extension_service_->Init(); 183 extension_service_->Init();
184 184
185 if (extensions_enabled) { 185 if (extensions_enabled) {
186 // Load any extensions specified with --load-extension. 186 // Load any extensions specified with --load-extension.
187 // TODO(yoz): Seems like this should move into ExtensionService::Init. 187 // TODO(yoz): Seems like this should move into ExtensionService::Init.
188 // But maybe it's no longer important. 188 // But maybe it's no longer important.
189 if (command_line->HasSwitch(switches::kLoadExtension)) { 189 if (command_line->HasSwitch(switches::kLoadExtension)) {
190 CommandLine::StringType path_list = command_line->GetSwitchValueNative( 190 CommandLine::StringType path_list = command_line->GetSwitchValueNative(
191 switches::kLoadExtension); 191 switches::kLoadExtension);
192 StringTokenizerT<CommandLine::StringType, 192 base::StringTokenizerT<CommandLine::StringType,
193 CommandLine::StringType::const_iterator> t(path_list, 193 CommandLine::StringType::const_iterator> t(path_list,
194 FILE_PATH_LITERAL(",")); 194 FILE_PATH_LITERAL(","));
195 while (t.GetNext()) { 195 while (t.GetNext()) {
196 UnpackedInstaller::Create(extension_service_.get())-> 196 UnpackedInstaller::Create(extension_service_.get())->
197 LoadFromCommandLine(FilePath(t.token())); 197 LoadFromCommandLine(FilePath(t.token()));
198 } 198 }
199 } 199 }
200 } 200 }
201 201
202 // Make the chrome://extension-icon/ resource available. 202 // Make the chrome://extension-icon/ resource available.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 448 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
449 const std::string& extension_id, 449 const std::string& extension_id,
450 const extension_misc::UnloadedExtensionReason reason) { 450 const extension_misc::UnloadedExtensionReason reason) {
451 BrowserThread::PostTask( 451 BrowserThread::PostTask(
452 BrowserThread::IO, FROM_HERE, 452 BrowserThread::IO, FROM_HERE,
453 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), 453 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(),
454 extension_id, reason)); 454 extension_id, reason));
455 } 455 }
456 456
457 } // namespace extensions 457 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api_helpers.cc ('k') | chrome/browser/google_apis/fake_drive_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698