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

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

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: replace missing extension_system include Created 8 years 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
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/user_script_master.h" 5 #include "chrome/browser/extensions/user_script_master.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/pickle.h" 14 #include "base/pickle.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/version.h" 18 #include "base/version.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_system.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/extensions/extension.h" 23 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_file_util.h" 24 #include "chrome/common/extensions/extension_file_util.h"
24 #include "chrome/common/extensions/extension_resource.h" 25 #include "chrome/common/extensions/extension_resource.h"
25 #include "chrome/common/extensions/extension_set.h" 26 #include "chrome/common/extensions/extension_set.h"
26 #include "chrome/common/extensions/message_bundle.h" 27 #include "chrome/common/extensions/message_bundle.h"
27 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/render_process_host.h" 29 #include "content/public/browser/render_process_host.h"
29 30
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 extensions_service_ready_ = true; 353 extensions_service_ready_ = true;
353 should_start_load = true; 354 should_start_load = true;
354 break; 355 break;
355 case chrome::NOTIFICATION_EXTENSION_LOADED: { 356 case chrome::NOTIFICATION_EXTENSION_LOADED: {
356 // Add any content scripts inside the extension. 357 // Add any content scripts inside the extension.
357 const Extension* extension = 358 const Extension* extension =
358 content::Details<const Extension>(details).ptr(); 359 content::Details<const Extension>(details).ptr();
359 extensions_info_[extension->id()] = 360 extensions_info_[extension->id()] =
360 ExtensionSet::ExtensionPathAndDefaultLocale( 361 ExtensionSet::ExtensionPathAndDefaultLocale(
361 extension->path(), extension->default_locale()); 362 extension->path(), extension->default_locale());
362 bool incognito_enabled = profile_->GetExtensionService()-> 363 bool incognito_enabled = extensions::ExtensionSystem::Get(profile_)->
363 IsIncognitoEnabled(extension->id()); 364 extension_service()->IsIncognitoEnabled(extension->id());
364 const UserScriptList& scripts = extension->content_scripts(); 365 const UserScriptList& scripts = extension->content_scripts();
365 for (UserScriptList::const_iterator iter = scripts.begin(); 366 for (UserScriptList::const_iterator iter = scripts.begin();
366 iter != scripts.end(); ++iter) { 367 iter != scripts.end(); ++iter) {
367 user_scripts_.push_back(*iter); 368 user_scripts_.push_back(*iter);
368 user_scripts_.back().set_incognito_enabled(incognito_enabled); 369 user_scripts_.back().set_incognito_enabled(incognito_enabled);
369 } 370 }
370 if (extensions_service_ready_) 371 if (extensions_service_ready_)
371 should_start_load = true; 372 should_start_load = true;
372 break; 373 break;
373 } 374 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 437
437 base::SharedMemoryHandle handle_for_process; 438 base::SharedMemoryHandle handle_for_process;
438 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 439 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
439 return; // This can legitimately fail if the renderer asserts at startup. 440 return; // This can legitimately fail if the renderer asserts at startup.
440 441
441 if (base::SharedMemory::IsHandleValid(handle_for_process)) 442 if (base::SharedMemory::IsHandleValid(handle_for_process))
442 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 443 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
443 } 444 }
444 445
445 } // namespace extensions 446 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698