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

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

Issue 25366003: Moved some functions off ExtensionService into a new file extension_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile failures Created 7 years, 2 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/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_util.h" 12 #include "base/file_util.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.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/strings/string_util.h" 16 #include "base/strings/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/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_system.h" 21 #include "chrome/browser/extensions/extension_system.h"
22 #include "chrome/browser/extensions/extension_util.h"
22 #include "chrome/browser/extensions/image_loader.h" 23 #include "chrome/browser/extensions/image_loader.h"
23 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 25 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
25 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
26 #include "chrome/common/extensions/extension_file_util.h" 27 #include "chrome/common/extensions/extension_file_util.h"
27 #include "chrome/common/extensions/extension_set.h" 28 #include "chrome/common/extensions/extension_set.h"
28 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" 29 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
29 #include "chrome/common/extensions/message_bundle.h" 30 #include "chrome/common/extensions/message_bundle.h"
30 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
31 #include "content/public/browser/render_process_host.h" 32 #include "content/public/browser/render_process_host.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 extensions_service_ready_ = true; 367 extensions_service_ready_ = true;
367 should_start_load = true; 368 should_start_load = true;
368 break; 369 break;
369 case chrome::NOTIFICATION_EXTENSION_LOADED: { 370 case chrome::NOTIFICATION_EXTENSION_LOADED: {
370 // Add any content scripts inside the extension. 371 // Add any content scripts inside the extension.
371 const Extension* extension = 372 const Extension* extension =
372 content::Details<const Extension>(details).ptr(); 373 content::Details<const Extension>(details).ptr();
373 extensions_info_[extension->id()] = 374 extensions_info_[extension->id()] =
374 ExtensionSet::ExtensionPathAndDefaultLocale( 375 ExtensionSet::ExtensionPathAndDefaultLocale(
375 extension->path(), LocaleInfo::GetDefaultLocale(extension)); 376 extension->path(), LocaleInfo::GetDefaultLocale(extension));
376 bool incognito_enabled = extensions::ExtensionSystem::Get(profile_)-> 377 bool incognito_enabled = extension_util::IsIncognitoEnabled(
377 extension_service()->IsIncognitoEnabled(extension->id()); 378 extension->id(),
379 extensions::ExtensionSystem::Get(profile_)->extension_service());
378 const UserScriptList& scripts = 380 const UserScriptList& scripts =
379 ContentScriptsInfo::GetContentScripts(extension); 381 ContentScriptsInfo::GetContentScripts(extension);
380 for (UserScriptList::const_iterator iter = scripts.begin(); 382 for (UserScriptList::const_iterator iter = scripts.begin();
381 iter != scripts.end(); ++iter) { 383 iter != scripts.end(); ++iter) {
382 user_scripts_.push_back(*iter); 384 user_scripts_.push_back(*iter);
383 user_scripts_.back().set_incognito_enabled(incognito_enabled); 385 user_scripts_.back().set_incognito_enabled(incognito_enabled);
384 } 386 }
385 if (extensions_service_ready_) 387 if (extensions_service_ready_)
386 should_start_load = true; 388 should_start_load = true;
387 break; 389 break;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 453
452 base::SharedMemoryHandle handle_for_process; 454 base::SharedMemoryHandle handle_for_process;
453 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 455 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
454 return; // This can legitimately fail if the renderer asserts at startup. 456 return; // This can legitimately fail if the renderer asserts at startup.
455 457
456 if (base::SharedMemory::IsHandleValid(handle_for_process)) 458 if (base::SharedMemory::IsHandleValid(handle_for_process))
457 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 459 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
458 } 460 }
459 461
460 } // namespace extensions 462 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.cc ('k') | chrome/browser/sync/test/integration/sync_extension_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698