| OLD | NEW |
| 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/sync/test/integration/themes_helper.h" | 5 #include "chrome/browser/sync/test/integration/themes_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 9 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 10 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | |
| 11 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | |
| 12 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | 10 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
| 13 #include "chrome/browser/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
| 14 #include "chrome/browser/themes/theme_service_factory.h" | 12 #include "chrome/browser/themes/theme_service_factory.h" |
| 15 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/extensions/manifest.h" | 14 #include "chrome/common/extensions/manifest.h" |
| 15 #include "extensions/common/id_util.h" |
| 17 | 16 |
| 18 using sync_datatype_helper::test; | 17 using sync_datatype_helper::test; |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 // Make a name to pass to an extension helper. | 21 // Make a name to pass to an extension helper. |
| 23 std::string MakeName(int index) { | 22 std::string MakeName(int index) { |
| 24 return "faketheme" + base::IntToString(index); | 23 return "faketheme" + base::IntToString(index); |
| 25 } | 24 } |
| 26 | 25 |
| 27 ThemeService* GetThemeService(Profile* profile) { | 26 ThemeService* GetThemeService(Profile* profile) { |
| 28 return ThemeServiceFactory::GetForProfile(profile); | 27 return ThemeServiceFactory::GetForProfile(profile); |
| 29 } | 28 } |
| 30 | 29 |
| 31 } // namespace | 30 } // namespace |
| 32 | 31 |
| 33 namespace themes_helper { | 32 namespace themes_helper { |
| 34 | 33 |
| 35 std::string GetCustomTheme(int index) { | 34 std::string GetCustomTheme(int index) { |
| 36 return SyncExtensionHelper::GetInstance()->NameToId(MakeName(index)); | 35 return extensions::id_util::GenerateId(MakeName(index)); |
| 37 } | 36 } |
| 38 | 37 |
| 39 std::string GetThemeID(Profile* profile) { | 38 std::string GetThemeID(Profile* profile) { |
| 40 return GetThemeService(profile)->GetThemeID(); | 39 return GetThemeService(profile)->GetThemeID(); |
| 41 } | 40 } |
| 42 | 41 |
| 43 bool UsingCustomTheme(Profile* profile) { | 42 bool UsingCustomTheme(Profile* profile) { |
| 44 return GetThemeID(profile) != ThemeService::kDefaultThemeID; | 43 return GetThemeID(profile) != ThemeService::kDefaultThemeID; |
| 45 } | 44 } |
| 46 | 45 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 void UseDefaultTheme(Profile* profile) { | 68 void UseDefaultTheme(Profile* profile) { |
| 70 GetThemeService(profile)->UseDefaultTheme(); | 69 GetThemeService(profile)->UseDefaultTheme(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void UseNativeTheme(Profile* profile) { | 72 void UseNativeTheme(Profile* profile) { |
| 74 // TODO(akalin): Fix this inconsistent naming in the theme service. | 73 // TODO(akalin): Fix this inconsistent naming in the theme service. |
| 75 GetThemeService(profile)->SetNativeTheme(); | 74 GetThemeService(profile)->SetNativeTheme(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 } // namespace themes_helper | 77 } // namespace themes_helper |
| OLD | NEW |