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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. 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 | 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/ui/ash/launcher/chrome_launcher_controller_per_browser. h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/launcher/launcher_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 display_pref->GetString(path, &per_display_value)) { 184 display_pref->GetString(path, &per_display_value)) {
185 return per_display_value; 185 return per_display_value;
186 } 186 }
187 } 187 }
188 188
189 return value; 189 return value;
190 } 190 }
191 191
192 // If prefs have synced and no user-set value exists at |local_path|, the value 192 // If prefs have synced and no user-set value exists at |local_path|, the value
193 // from |synced_path| is copied to |local_path|. 193 // from |synced_path| is copied to |local_path|.
194 void MaybePropagatePrefToLocal(PrefService* pref_service, 194 void MaybePropagatePrefToLocal(PrefServiceSyncable* pref_service,
195 const char* local_path, 195 const char* local_path,
196 const char* synced_path) { 196 const char* synced_path) {
197 if (!pref_service->FindPreference(local_path)->HasUserSetting() && 197 if (!pref_service->FindPreference(local_path)->HasUserSetting() &&
198 pref_service->IsSyncing()) { 198 pref_service->IsSyncing()) {
199 // First time the user is using this machine, propagate from remote to 199 // First time the user is using this machine, propagate from remote to
200 // local. 200 // local.
201 pref_service->SetString(local_path, pref_service->GetString(synced_path)); 201 pref_service->SetString(local_path, pref_service->GetString(synced_path));
202 } 202 }
203 } 203 }
204 204
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 profile_->GetPrefs()->RemoveObserver(this); 273 profile_->GetPrefs()->RemoveObserver(this);
274 } 274 }
275 275
276 void ChromeLauncherControllerPerBrowser::Init() { 276 void ChromeLauncherControllerPerBrowser::Init() {
277 UpdateAppLaunchersFromPref(); 277 UpdateAppLaunchersFromPref();
278 278
279 // TODO(sky): update unit test so that this test isn't necessary. 279 // TODO(sky): update unit test so that this test isn't necessary.
280 if (ash::Shell::HasInstance()) { 280 if (ash::Shell::HasInstance()) {
281 SetShelfAutoHideBehaviorFromPrefs(); 281 SetShelfAutoHideBehaviorFromPrefs();
282 SetShelfAlignmentFromPrefs(); 282 SetShelfAlignmentFromPrefs();
283 PrefService* prefs = profile_->GetPrefs(); 283 PrefServiceSyncable* prefs = profile_->GetPrefs();
284 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || 284 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() ||
285 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> 285 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)->
286 HasUserSetting()) { 286 HasUserSetting()) {
287 // This causes OnIsSyncingChanged to be called when the value of 287 // This causes OnIsSyncingChanged to be called when the value of
288 // PrefService::IsSyncing() changes. 288 // PrefService::IsSyncing() changes.
289 prefs->AddObserver(this); 289 prefs->AddObserver(this);
290 } 290 }
291 ash::Shell::GetInstance()->AddShellObserver(this); 291 ash::Shell::GetInstance()->AddShellObserver(this);
292 } 292 }
293 } 293 }
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( 1206 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest(
1207 AppIconLoader* loader) { 1207 AppIconLoader* loader) {
1208 app_icon_loader_.reset(loader); 1208 app_icon_loader_.reset(loader);
1209 } 1209 }
1210 1210
1211 const std::string& 1211 const std::string&
1212 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( 1212 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest(
1213 ash::LauncherID id) { 1213 ash::LauncherID id) {
1214 return id_to_item_controller_map_[id]->app_id(); 1214 return id_to_item_controller_map_[id]->app_id();
1215 } 1215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698