| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 bool loaded_pack = false; | 561 bool loaded_pack = false; |
| 562 | 562 |
| 563 // If we don't have a file pack, we're updating from an old version, or the | 563 // If we don't have a file pack, we're updating from an old version, or the |
| 564 // pack was created for an alternative MaterialDesignController::Mode. | 564 // pack was created for an alternative MaterialDesignController::Mode. |
| 565 base::FilePath path = prefs->GetFilePath(prefs::kCurrentThemePackFilename); | 565 base::FilePath path = prefs->GetFilePath(prefs::kCurrentThemePackFilename); |
| 566 if (path != base::FilePath()) { | 566 if (path != base::FilePath()) { |
| 567 path = path.Append(ui::MaterialDesignController::IsModeMaterial() | 567 path = path.Append(ui::MaterialDesignController::IsModeMaterial() |
| 568 ? chrome::kThemePackMaterialDesignFilename | 568 ? chrome::kThemePackMaterialDesignFilename |
| 569 : chrome::kThemePackFilename); | 569 : chrome::kThemePackFilename); |
| 570 SwapThemeSupplier(BrowserThemePack::BuildFromDataPack(path, current_id)); | 570 SwapThemeSupplier(BrowserThemePack::BuildFromDataPack(path, current_id)); |
| 571 loaded_pack = theme_supplier_ != nullptr; | 571 if (theme_supplier_) |
| 572 loaded_pack = true; |
| 572 } | 573 } |
| 573 | 574 |
| 574 if (loaded_pack) { | 575 if (loaded_pack) { |
| 575 content::RecordAction(UserMetricsAction("Themes.Loaded")); | 576 content::RecordAction(UserMetricsAction("Themes.Loaded")); |
| 576 set_ready(); | 577 set_ready(); |
| 577 } | 578 } |
| 578 // Else: wait for the extension service to be ready so that the theme pack | 579 // Else: wait for the extension service to be ready so that the theme pack |
| 579 // can be recreated from the extension. | 580 // can be recreated from the extension. |
| 580 } | 581 } |
| 581 | 582 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 860 |
| 860 #if defined(ENABLE_SUPERVISED_USERS) | 861 #if defined(ENABLE_SUPERVISED_USERS) |
| 861 bool ThemeService::IsSupervisedUser() const { | 862 bool ThemeService::IsSupervisedUser() const { |
| 862 return profile_->IsSupervised(); | 863 return profile_->IsSupervised(); |
| 863 } | 864 } |
| 864 | 865 |
| 865 void ThemeService::SetSupervisedUserTheme() { | 866 void ThemeService::SetSupervisedUserTheme() { |
| 866 SetCustomDefaultTheme(new SupervisedUserTheme); | 867 SetCustomDefaultTheme(new SupervisedUserTheme); |
| 867 } | 868 } |
| 868 #endif | 869 #endif |
| OLD | NEW |