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

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

Issue 23851016: Convert zoom callbacks to use CallbackRegistry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge 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
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 prefs::kClearSiteDataOnExit, 366 prefs::kClearSiteDataOnExit,
367 false, 367 false,
368 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 368 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
369 } 369 }
370 370
371 ProfileImpl::ProfileImpl( 371 ProfileImpl::ProfileImpl(
372 const base::FilePath& path, 372 const base::FilePath& path,
373 Delegate* delegate, 373 Delegate* delegate,
374 CreateMode create_mode, 374 CreateMode create_mode,
375 base::SequencedTaskRunner* sequenced_task_runner) 375 base::SequencedTaskRunner* sequenced_task_runner)
376 : zoom_callback_(base::Bind(&ProfileImpl::OnZoomLevelChanged, 376 : path_(path),
377 base::Unretained(this))),
378 path_(path),
379 pref_registry_(new user_prefs::PrefRegistrySyncable), 377 pref_registry_(new user_prefs::PrefRegistrySyncable),
380 io_data_(this), 378 io_data_(this),
381 host_content_settings_map_(NULL), 379 host_content_settings_map_(NULL),
382 last_session_exit_type_(EXIT_NORMAL), 380 last_session_exit_type_(EXIT_NORMAL),
383 start_time_(Time::Now()), 381 start_time_(Time::Now()),
384 delegate_(delegate), 382 delegate_(delegate),
385 predictor_(NULL) { 383 predictor_(NULL) {
386 TRACE_EVENT0("browser", "ProfileImpl::ctor") 384 TRACE_EVENT0("browser", "ProfileImpl::ctor")
387 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << 385 DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
388 "profile files to the root directory!"; 386 "profile files to the root directory!";
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 i.Advance()) { 622 i.Advance()) {
625 const std::string& host(i.key()); 623 const std::string& host(i.key());
626 double zoom_level = 0; 624 double zoom_level = 0;
627 625
628 bool success = i.value().GetAsDouble(&zoom_level); 626 bool success = i.value().GetAsDouble(&zoom_level);
629 DCHECK(success); 627 DCHECK(success);
630 host_zoom_map->SetZoomLevelForHost(host, zoom_level); 628 host_zoom_map->SetZoomLevelForHost(host, zoom_level);
631 } 629 }
632 } 630 }
633 631
634 host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); 632 zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback(
633 base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this)));
635 } 634 }
636 635
637 base::FilePath ProfileImpl::last_selected_directory() { 636 base::FilePath ProfileImpl::last_selected_directory() {
638 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); 637 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
639 } 638 }
640 639
641 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { 640 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) {
642 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); 641 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path);
643 } 642 }
644 643
645 ProfileImpl::~ProfileImpl() { 644 ProfileImpl::~ProfileImpl() {
646 MaybeSendDestroyedNotification(); 645 MaybeSendDestroyedNotification();
647 646
648 HostZoomMap::GetForBrowserContext(this)->RemoveZoomLevelChangedCallback(
649 zoom_callback_);
650
651 bool prefs_loaded = prefs_->GetInitializationStatus() != 647 bool prefs_loaded = prefs_->GetInitializationStatus() !=
652 PrefService::INITIALIZATION_STATUS_WAITING; 648 PrefService::INITIALIZATION_STATUS_WAITING;
653 649
654 #if defined(ENABLE_SESSION_SERVICE) 650 #if defined(ENABLE_SESSION_SERVICE)
655 StopCreateSessionServiceTimer(); 651 StopCreateSessionServiceTimer();
656 #endif 652 #endif
657 653
658 // Remove pref observers 654 // Remove pref observers
659 pref_change_registrar_.RemoveAll(); 655 pref_change_registrar_.RemoveAll();
660 656
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { 1196 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() {
1201 #if defined(OS_CHROMEOS) 1197 #if defined(OS_CHROMEOS)
1202 if (chromeos::ProfileHelper::IsSigninProfile(this)) { 1198 if (chromeos::ProfileHelper::IsSigninProfile(this)) {
1203 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( 1199 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
1204 g_browser_process->local_state()); 1200 g_browser_process->local_state());
1205 } 1201 }
1206 #endif // defined(OS_CHROMEOS) 1202 #endif // defined(OS_CHROMEOS)
1207 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( 1203 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile(
1208 GetPrefs(), g_browser_process->local_state()); 1204 GetPrefs(), g_browser_process->local_state());
1209 } 1205 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698