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

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

Issue 6546072: Clean up how we handle themes in the extensions system and management API.... Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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) 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); 275 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this);
276 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); 276 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this);
277 277
278 // It would be nice to use PathService for fetching this directory, but 278 // It would be nice to use PathService for fetching this directory, but
279 // the cache directory depends on the profile directory, which isn't available 279 // the cache directory depends on the profile directory, which isn't available
280 // to PathService. 280 // to PathService.
281 chrome::GetUserCacheDirectory(path_, &base_cache_path_); 281 chrome::GetUserCacheDirectory(path_, &base_cache_path_);
282 file_util::CreateDirectory(base_cache_path_); 282 file_util::CreateDirectory(base_cache_path_);
283 283
284 // Listen for theme installations from our original profile. 284 // Listen for theme installations from our original profile.
285 registrar_.Add(this, NotificationType::THEME_INSTALLED, 285 registrar_.Add(this, NotificationType::EXTENSION_INSTALLED,
286 Source<Profile>(GetOriginalProfile())); 286 Source<Profile>(GetOriginalProfile()));
287 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
288 Source<Profile>(GetOriginalProfile()));
289
290 // Once the extensions system is ready, we want to listen to EXTENSION_LOADED
291 // events (they get sent for enabled extensions during startup).
292 registrar_.Add(this, NotificationType::EXTENSIONS_READY,
293 Source<Profile>(GetOriginalProfile()));
294
287 295
288 #if !defined(OS_CHROMEOS) 296 #if !defined(OS_CHROMEOS)
289 // Listen for bookmark model load, to bootstrap the sync service. 297 // Listen for bookmark model load, to bootstrap the sync service.
290 // On CrOS sync service will be initialized after sign in. 298 // On CrOS sync service will be initialized after sign in.
291 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, 299 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED,
292 Source<Profile>(this)); 300 Source<Profile>(this));
293 #endif 301 #endif
294 302
295 ssl_config_service_manager_.reset( 303 ssl_config_service_manager_.reset(
296 SSLConfigServiceManager::CreateDefaultManager(this)); 304 SSLConfigServiceManager::CreateDefaultManager(this));
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 prefs->GetBoolean(prefs::kClearSiteDataOnExit); 1280 prefs->GetBoolean(prefs::kClearSiteDataOnExit);
1273 if (webkit_context_) { 1281 if (webkit_context_) {
1274 webkit_context_->set_clear_local_state_on_exit( 1282 webkit_context_->set_clear_local_state_on_exit(
1275 clear_local_state_on_exit_); 1283 clear_local_state_on_exit_);
1276 } 1284 }
1277 if (appcache_service_) { 1285 if (appcache_service_) {
1278 appcache_service_->SetClearLocalStateOnExit( 1286 appcache_service_->SetClearLocalStateOnExit(
1279 clear_local_state_on_exit_); 1287 clear_local_state_on_exit_);
1280 } 1288 }
1281 } 1289 }
1282 } else if (NotificationType::THEME_INSTALLED == type) { 1290 } else if (NotificationType::EXTENSIONS_READY == type) {
1291 registrar_.Add(this, NotificationType::EXTENSION_LOADED,
1292 Source<Profile>(GetOriginalProfile()));
1293 } else if (NotificationType::EXTENSION_INSTALLED == type) {
1283 DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile()); 1294 DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile());
1284 const Extension* extension = Details<const Extension>(details).ptr(); 1295 const Extension* extension = Details<const Extension>(details).ptr();
1285 SetTheme(extension); 1296 if (extension->is_theme())
1297 SetTheme(extension);
1298 } else if (NotificationType::EXTENSION_LOADED == type) {
1299 DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile());
1300 const Extension* extension = Details<const Extension>(details).ptr();
1301 if (extension->is_theme() &&
1302 extension->id() != GetThemeProvider()->GetThemeID())
1303 SetTheme(extension);
1304 } else if (NotificationType::EXTENSION_UNLOADED == type) {
1305 DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile());
1306 UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr();
1307 const Extension* extension = info->extension;
1308 if (extension->id() == GetThemeProvider()->GetThemeID() &&
1309 info->reason != UnloadedExtensionInfo::UPDATE)
1310 ClearTheme();
1286 } else if (NotificationType::BOOKMARK_MODEL_LOADED == type) { 1311 } else if (NotificationType::BOOKMARK_MODEL_LOADED == type) {
1287 GetProfileSyncService(); // Causes lazy-load if sync is enabled. 1312 GetProfileSyncService(); // Causes lazy-load if sync is enabled.
1288 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, 1313 registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED,
1289 Source<Profile>(this)); 1314 Source<Profile>(this));
1290 } 1315 }
1291 } 1316 }
1292 1317
1293 void ProfileImpl::StopCreateSessionServiceTimer() { 1318 void ProfileImpl::StopCreateSessionServiceTimer() {
1294 create_session_service_timer_.Stop(); 1319 create_session_service_timer_.Stop();
1295 } 1320 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 return pref_proxy_config_tracker_; 1529 return pref_proxy_config_tracker_;
1505 } 1530 }
1506 1531
1507 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { 1532 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() {
1508 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) 1533 if (!prerender::PrerenderManager::IsPrerenderingEnabled())
1509 return NULL; 1534 return NULL;
1510 if (!prerender_manager_) 1535 if (!prerender_manager_)
1511 prerender_manager_ = new prerender::PrerenderManager(this); 1536 prerender_manager_ = new prerender::PrerenderManager(this);
1512 return prerender_manager_; 1537 return prerender_manager_;
1513 } 1538 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/theme_installed_infobar_delegate.cc ('k') | chrome/browser/themes/browser_theme_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698