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

Side by Side Diff: chrome/browser/themes/theme_service.cc

Issue 316863002: Rename "managed (mode|user)" to "supervised user" (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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
« no previous file with comments | « chrome/browser/themes/theme_service.h ('k') | chrome/browser/themes/theme_service_unittest.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/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 case Properties::COLOR_NTP_SECTION_HEADER_TEXT: 144 case Properties::COLOR_NTP_SECTION_HEADER_TEXT:
145 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.30); 145 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.30);
146 case Properties::COLOR_NTP_SECTION_HEADER_TEXT_HOVER: 146 case Properties::COLOR_NTP_SECTION_HEADER_TEXT_HOVER:
147 return GetColor(Properties::COLOR_NTP_TEXT); 147 return GetColor(Properties::COLOR_NTP_TEXT);
148 case Properties::COLOR_NTP_SECTION_HEADER_RULE: 148 case Properties::COLOR_NTP_SECTION_HEADER_RULE:
149 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.70); 149 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.70);
150 case Properties::COLOR_NTP_SECTION_HEADER_RULE_LIGHT: 150 case Properties::COLOR_NTP_SECTION_HEADER_RULE_LIGHT:
151 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.86); 151 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.86);
152 case Properties::COLOR_NTP_TEXT_LIGHT: 152 case Properties::COLOR_NTP_TEXT_LIGHT:
153 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.40); 153 return IncreaseLightness(GetColor(Properties::COLOR_NTP_TEXT), 0.40);
154 case Properties::COLOR_MANAGED_USER_LABEL: 154 case Properties::COLOR_SUPERVISED_USER_LABEL:
155 return color_utils::GetReadableColor( 155 return color_utils::GetReadableColor(
156 SK_ColorWHITE, 156 SK_ColorWHITE,
157 GetColor(Properties::COLOR_MANAGED_USER_LABEL_BACKGROUND)); 157 GetColor(Properties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND));
158 case Properties::COLOR_MANAGED_USER_LABEL_BACKGROUND: 158 case Properties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND:
159 return color_utils::BlendTowardOppositeLuminance( 159 return color_utils::BlendTowardOppositeLuminance(
160 GetColor(Properties::COLOR_FRAME), 0x80); 160 GetColor(Properties::COLOR_FRAME), 0x80);
161 case Properties::COLOR_MANAGED_USER_LABEL_BORDER: 161 case Properties::COLOR_SUPERVISED_USER_LABEL_BORDER:
162 return color_utils::AlphaBlend( 162 return color_utils::AlphaBlend(
163 GetColor(Properties::COLOR_MANAGED_USER_LABEL_BACKGROUND), 163 GetColor(Properties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND),
164 SK_ColorBLACK, 164 SK_ColorBLACK,
165 230); 165 230);
166 case Properties::COLOR_STATUS_BAR_TEXT: { 166 case Properties::COLOR_STATUS_BAR_TEXT: {
167 // A long time ago, we blended the toolbar and the tab text together to 167 // A long time ago, we blended the toolbar and the tab text together to
168 // get the status bar text because, at the time, our text rendering in 168 // get the status bar text because, at the time, our text rendering in
169 // views couldn't do alpha blending. Even though this is no longer the 169 // views couldn't do alpha blending. Even though this is no longer the
170 // case, this blending decision is built into the majority of themes that 170 // case, this blending decision is built into the majority of themes that
171 // exist, and we must keep doing it. 171 // exist, and we must keep doing it.
172 SkColor toolbar_color = GetColor(Properties::COLOR_TOOLBAR); 172 SkColor toolbar_color = GetColor(Properties::COLOR_TOOLBAR);
173 SkColor text_color = GetColor(Properties::COLOR_TAB_TEXT); 173 SkColor text_color = GetColor(Properties::COLOR_TAB_TEXT);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // are installed but not loaded because they are blacklisted by a management 366 // are installed but not loaded because they are blacklisted by a management
367 // policy provider. 367 // policy provider.
368 368
369 for (size_t i = 0; i < remove_list.size(); ++i) 369 for (size_t i = 0; i < remove_list.size(); ++i)
370 service->UninstallExtension(remove_list[i], false, NULL); 370 service->UninstallExtension(remove_list[i], false, NULL);
371 } 371 }
372 372
373 void ThemeService::UseDefaultTheme() { 373 void ThemeService::UseDefaultTheme() {
374 if (ready_) 374 if (ready_)
375 content::RecordAction(UserMetricsAction("Themes_Reset")); 375 content::RecordAction(UserMetricsAction("Themes_Reset"));
376 if (IsManagedUser()) { 376 if (IsSupervisedUser()) {
377 SetManagedUserTheme(); 377 SetSupervisedUserTheme();
378 return; 378 return;
379 } 379 }
380 ClearAllThemeData(); 380 ClearAllThemeData();
381 NotifyThemeChanged(); 381 NotifyThemeChanged();
382 } 382 }
383 383
384 void ThemeService::UseSystemTheme() { 384 void ThemeService::UseSystemTheme() {
385 UseDefaultTheme(); 385 UseDefaultTheme();
386 } 386 }
387 387
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 base::Bind(&ThemeService::RemoveUnusedThemes, 425 base::Bind(&ThemeService::RemoveUnusedThemes,
426 weak_ptr_factory_.GetWeakPtr(), 426 weak_ptr_factory_.GetWeakPtr(),
427 true)); 427 true));
428 } 428 }
429 429
430 void ThemeService::LoadThemePrefs() { 430 void ThemeService::LoadThemePrefs() {
431 PrefService* prefs = profile_->GetPrefs(); 431 PrefService* prefs = profile_->GetPrefs();
432 432
433 std::string current_id = GetThemeID(); 433 std::string current_id = GetThemeID();
434 if (current_id == kDefaultThemeID) { 434 if (current_id == kDefaultThemeID) {
435 // Managed users have a different default theme. 435 // Supervised users have a different default theme.
436 if (IsManagedUser()) 436 if (IsSupervisedUser())
437 SetManagedUserTheme(); 437 SetSupervisedUserTheme();
438 else if (ShouldInitWithSystemTheme()) 438 else if (ShouldInitWithSystemTheme())
439 UseSystemTheme(); 439 UseSystemTheme();
440 else 440 else
441 UseDefaultTheme(); 441 UseDefaultTheme();
442 set_ready(); 442 set_ready();
443 return; 443 return;
444 } 444 }
445 445
446 bool loaded_pack = false; 446 bool loaded_pack = false;
447 447
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 base::FilePath pack_path = 574 base::FilePath pack_path =
575 extension->path().Append(chrome::kThemePackFilename); 575 extension->path().Append(chrome::kThemePackFilename);
576 service->GetFileTaskRunner()->PostTask( 576 service->GetFileTaskRunner()->PostTask(
577 FROM_HERE, 577 FROM_HERE,
578 base::Bind(&WritePackToDiskCallback, pack, pack_path)); 578 base::Bind(&WritePackToDiskCallback, pack, pack_path));
579 579
580 SavePackName(pack_path); 580 SavePackName(pack_path);
581 SwapThemeSupplier(pack); 581 SwapThemeSupplier(pack);
582 } 582 }
583 583
584 bool ThemeService::IsManagedUser() const { 584 bool ThemeService::IsSupervisedUser() const {
585 return profile_->IsManaged(); 585 return profile_->IsSupervised();
586 } 586 }
587 587
588 void ThemeService::SetManagedUserTheme() { 588 void ThemeService::SetSupervisedUserTheme() {
589 SetCustomDefaultTheme(new ManagedUserTheme); 589 SetCustomDefaultTheme(new ManagedUserTheme);
590 } 590 }
591 591
592 void ThemeService::OnInfobarDisplayed() { 592 void ThemeService::OnInfobarDisplayed() {
593 number_of_infobars_++; 593 number_of_infobars_++;
594 } 594 }
595 595
596 void ThemeService::OnInfobarDestroyed() { 596 void ThemeService::OnInfobarDestroyed() {
597 number_of_infobars_--; 597 number_of_infobars_--;
598 598
599 if (number_of_infobars_ == 0) 599 if (number_of_infobars_ == 0)
600 RemoveUnusedThemes(false); 600 RemoveUnusedThemes(false);
601 } 601 }
602 602
603 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { 603 ThemeSyncableService* ThemeService::GetThemeSyncableService() const {
604 return theme_syncable_service_.get(); 604 return theme_syncable_service_.get();
605 } 605 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service.h ('k') | chrome/browser/themes/theme_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698