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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 7189029: Implement an initial extension settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add missing files Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/defaults.h" 26 #include "chrome/browser/defaults.h"
27 #include "chrome/browser/download/download_manager.h" 27 #include "chrome/browser/download/download_manager.h"
28 #include "chrome/browser/extensions/extension_devtools_manager.h" 28 #include "chrome/browser/extensions/extension_devtools_manager.h"
29 #include "chrome/browser/extensions/extension_error_reporter.h" 29 #include "chrome/browser/extensions/extension_error_reporter.h"
30 #include "chrome/browser/extensions/extension_event_router.h" 30 #include "chrome/browser/extensions/extension_event_router.h"
31 #include "chrome/browser/extensions/extension_info_map.h" 31 #include "chrome/browser/extensions/extension_info_map.h"
32 #include "chrome/browser/extensions/extension_message_service.h" 32 #include "chrome/browser/extensions/extension_message_service.h"
33 #include "chrome/browser/extensions/extension_pref_store.h" 33 #include "chrome/browser/extensions/extension_pref_store.h"
34 #include "chrome/browser/extensions/extension_process_manager.h" 34 #include "chrome/browser/extensions/extension_process_manager.h"
35 #include "chrome/browser/extensions/extension_service.h" 35 #include "chrome/browser/extensions/extension_service.h"
36 #include "chrome/browser/extensions/extension_settings.h"
36 #include "chrome/browser/extensions/extension_special_storage_policy.h" 37 #include "chrome/browser/extensions/extension_special_storage_policy.h"
37 #include "chrome/browser/extensions/user_script_master.h" 38 #include "chrome/browser/extensions/user_script_master.h"
38 #include "chrome/browser/favicon/favicon_service.h" 39 #include "chrome/browser/favicon/favicon_service.h"
39 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 40 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
40 #include "chrome/browser/history/history.h" 41 #include "chrome/browser/history/history.h"
41 #include "chrome/browser/history/top_sites.h" 42 #include "chrome/browser/history/top_sites.h"
42 #include "chrome/browser/instant/instant_controller.h" 43 #include "chrome/browser/instant/instant_controller.h"
43 #include "chrome/browser/net/chrome_url_request_context.h" 44 #include "chrome/browser/net/chrome_url_request_context.h"
44 #include "chrome/browser/net/gaia/token_service.h" 45 #include "chrome/browser/net/gaia/token_service.h"
45 #include "chrome/browser/net/net_pref_observer.h" 46 #include "chrome/browser/net/net_pref_observer.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (!extensions_enabled) 455 if (!extensions_enabled)
455 autoupdate_enabled = false; 456 autoupdate_enabled = false;
456 else 457 else
457 autoupdate_enabled = !command_line->HasSwitch(switches::kGuestSession); 458 autoupdate_enabled = !command_line->HasSwitch(switches::kGuestSession);
458 #endif 459 #endif
459 extension_service_.reset(new ExtensionService( 460 extension_service_.reset(new ExtensionService(
460 this, 461 this,
461 CommandLine::ForCurrentProcess(), 462 CommandLine::ForCurrentProcess(),
462 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 463 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
463 extension_prefs_.get(), 464 extension_prefs_.get(),
465 extension_settings_.get(),
464 autoupdate_enabled, 466 autoupdate_enabled,
465 extensions_enabled)); 467 extensions_enabled));
466 468
467 RegisterComponentExtensions(); 469 RegisterComponentExtensions();
468 extension_service_->Init(); 470 extension_service_->Init();
469 471
470 if (extensions_enabled) { 472 if (extensions_enabled) {
471 // Load any extensions specified with --load-extension. 473 // Load any extensions specified with --load-extension.
472 if (command_line->HasSwitch(switches::kLoadExtension)) { 474 if (command_line->HasSwitch(switches::kLoadExtension)) {
473 FilePath path = command_line->GetSwitchValuePath( 475 FilePath path = command_line->GetSwitchValuePath(
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 810
809 // The last session exited cleanly if there is no pref for 811 // The last session exited cleanly if there is no pref for
810 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. 812 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true.
811 last_session_exited_cleanly_ = 813 last_session_exited_cleanly_ =
812 prefs_->GetBoolean(prefs::kSessionExitedCleanly); 814 prefs_->GetBoolean(prefs::kSessionExitedCleanly);
813 // Mark the session as open. 815 // Mark the session as open.
814 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); 816 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false);
815 // Make sure we save to disk that the session has opened. 817 // Make sure we save to disk that the session has opened.
816 prefs_->ScheduleSavePersistentPrefs(); 818 prefs_->ScheduleSavePersistentPrefs();
817 819
820 FilePath install_directory =
821 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName);
822
818 // Ensure that preferences set by extensions are restored in the profile 823 // Ensure that preferences set by extensions are restored in the profile
819 // as early as possible. The constructor takes care of that. 824 // as early as possible. The constructor takes care of that.
820 extension_prefs_.reset(new ExtensionPrefs( 825 extension_prefs_.reset(new ExtensionPrefs(
821 prefs_.get(), 826 prefs_.get(),
822 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 827 install_directory,
823 GetExtensionPrefValueMap())); 828 GetExtensionPrefValueMap()));
824 829
830 extension_settings_.reset(new ExtensionSettings(install_directory));
831
825 DCHECK(!net_pref_observer_.get()); 832 DCHECK(!net_pref_observer_.get());
826 net_pref_observer_.reset( 833 net_pref_observer_.reset(
827 new NetPrefObserver(prefs_.get(), GetPrerenderManager())); 834 new NetPrefObserver(prefs_.get(), GetPrerenderManager()));
828 835
829 DoFinalInit(); 836 DoFinalInit();
830 } 837 }
831 838
832 PrefService* ProfileImpl::GetPrefs() { 839 PrefService* ProfileImpl::GetPrefs() {
833 DCHECK(prefs_.get()); // Should explicitly be initialized. 840 DCHECK(prefs_.get()); // Should explicitly be initialized.
834 return prefs_.get(); 841 return prefs_.get();
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 if (!prerender::PrerenderManager::IsPrerenderingPossible()) 1642 if (!prerender::PrerenderManager::IsPrerenderingPossible())
1636 return NULL; 1643 return NULL;
1637 if (!prerender_manager_.get()) { 1644 if (!prerender_manager_.get()) {
1638 CHECK(g_browser_process->prerender_tracker()); 1645 CHECK(g_browser_process->prerender_tracker());
1639 prerender_manager_.reset( 1646 prerender_manager_.reset(
1640 new prerender::PrerenderManager( 1647 new prerender::PrerenderManager(
1641 this, g_browser_process->prerender_tracker())); 1648 this, g_browser_process->prerender_tracker()));
1642 } 1649 }
1643 return prerender_manager_.get(); 1650 return prerender_manager_.get();
1644 } 1651 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698