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

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

Issue 6248017: Do not use local override for language settings: always sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy up Created 9 years, 11 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/environment.h" 8 #include "base/environment.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 } 1359 }
1360 } 1360 }
1361 */ 1361 */
1362 return instant_promo_counter_.get(); 1362 return instant_promo_counter_.get();
1363 #else 1363 #else
1364 return NULL; 1364 return NULL;
1365 #endif 1365 #endif
1366 } 1366 }
1367 1367
1368 #if defined(OS_CHROMEOS) 1368 #if defined(OS_CHROMEOS)
1369 void ProfileImpl::ChangeApplicationLocale( 1369 void ProfileImpl::ChangeApplicationLocale(const std::string& locale) {
1370 const std::string& locale, bool keep_local) {
1371 if (locale.empty()) { 1370 if (locale.empty()) {
1372 NOTREACHED(); 1371 NOTREACHED();
1373 return; 1372 return;
1374 } 1373 }
1375 if (keep_local) { 1374 GetPrefs()->SetString(prefs::kApplicationLocale, locale);
1376 GetPrefs()->SetString(prefs::kApplicationLocaleOverride, locale); 1375 // We keep kApplicationLocaleBackup value as a reference. In case value
1377 } else { 1376 // of kApplicationLocale preference would change due to sync from other
1378 GetPrefs()->SetString(prefs::kApplicationLocale, locale); 1377 // device then kApplicationLocaleBackup value will trigger and allow us
1379 GetPrefs()->ClearPref(prefs::kApplicationLocaleOverride); 1378 // to show notification about automatic locale change in LocaleChangeGuard.
1380 }
1381 GetPrefs()->SetString(prefs::kApplicationLocaleBackup, locale); 1379 GetPrefs()->SetString(prefs::kApplicationLocaleBackup, locale);
1382 GetPrefs()->ClearPref(prefs::kApplicationLocaleAccepted); 1380 GetPrefs()->ClearPref(prefs::kApplicationLocaleAccepted);
1383 // We maintain kApplicationLocale property in both a global storage 1381 // We maintain kApplicationLocale property in both a global storage
1384 // and user's profile. Global property determines locale of login screen, 1382 // and user's profile. Global property determines locale of login screen,
1385 // while user's profile determines his personal locale preference. 1383 // while user's profile determines his personal locale preference.
1386 g_browser_process->local_state()->SetString( 1384 g_browser_process->local_state()->SetString(
1387 prefs::kApplicationLocale, locale); 1385 prefs::kApplicationLocale, locale);
1388 1386
1389 GetPrefs()->SavePersistentPrefs(); 1387 GetPrefs()->SavePersistentPrefs();
1390 g_browser_process->local_state()->SavePersistentPrefs(); 1388 g_browser_process->local_state()->SavePersistentPrefs();
(...skipping 23 matching lines...) Expand all
1414 } 1412 }
1415 1413
1416 PrerenderManager* ProfileImpl::GetPrerenderManager() { 1414 PrerenderManager* ProfileImpl::GetPrerenderManager() {
1417 CommandLine* cl = CommandLine::ForCurrentProcess(); 1415 CommandLine* cl = CommandLine::ForCurrentProcess();
1418 if (!cl->HasSwitch(switches::kEnablePagePrerender)) 1416 if (!cl->HasSwitch(switches::kEnablePagePrerender))
1419 return NULL; 1417 return NULL;
1420 if (!prerender_manager_) 1418 if (!prerender_manager_)
1421 prerender_manager_ = new PrerenderManager(this); 1419 prerender_manager_ = new PrerenderManager(this);
1422 return prerender_manager_; 1420 return prerender_manager_;
1423 } 1421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698