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

Side by Side Diff: chrome/browser/sync/test/live_sync/themes_helper.cc

Issue 7841007: Rename browser/sync/test/live_sync directory to browser/sync/test/integration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 9 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/test/live_sync/themes_helper.h"
6
7 #include "base/logging.h"
8 #include "base/string_number_conversions.h"
9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/themes/theme_service_factory.h"
11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/browser/sync/test/live_sync/sync_datatype_helper.h"
13 #include "chrome/browser/sync/test/live_sync/sync_extension_helper.h"
14
15 using sync_datatype_helper::test;
16
17 namespace {
18
19 // Make a name to pass to an extension helper.
20 std::string MakeName(int index) {
21 return "faketheme" + base::IntToString(index);
22 }
23
24 ThemeService* GetThemeService(Profile* profile) {
25 return ThemeServiceFactory::GetForProfile(profile);
26 }
27
28 } // namespace
29
30 namespace themes_helper {
31
32 std::string GetCustomTheme(int index) {
33 return SyncExtensionHelper::GetInstance()->NameToId(MakeName(index));
34 }
35
36 std::string GetThemeID(Profile* profile) {
37 return GetThemeService(profile)->GetThemeID();
38 }
39
40 bool UsingCustomTheme(Profile* profile) {
41 return GetThemeID(profile) != ThemeService::kDefaultThemeID;
42 }
43
44 bool UsingDefaultTheme(Profile* profile) {
45 return GetThemeService(profile)->UsingDefaultTheme();
46 }
47
48 bool UsingNativeTheme(Profile* profile) {
49 return GetThemeService(profile)->UsingNativeTheme();
50 }
51
52 bool ThemeIsPendingInstall(Profile* profile, const std::string& id) {
53 return SyncExtensionHelper::GetInstance()->
54 IsExtensionPendingInstallForSync(profile, id);
55 }
56
57 bool HasOrWillHaveCustomTheme(Profile* profile, const std::string& id) {
58 return (GetThemeID(profile) == id) || ThemeIsPendingInstall(profile, id);
59 }
60
61 void UseCustomTheme(Profile* profile, int index) {
62 SyncExtensionHelper::GetInstance()->InstallExtension(
63 profile, MakeName(index), Extension::TYPE_THEME);
64 }
65
66 void UseDefaultTheme(Profile* profile) {
67 GetThemeService(profile)->UseDefaultTheme();
68 }
69
70 void UseNativeTheme(Profile* profile) {
71 // TODO(akalin): Fix this inconsistent naming in the theme service.
72 GetThemeService(profile)->SetNativeTheme();
73 }
74
75 } // namespace themes_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/live_sync/themes_helper.h ('k') | chrome/browser/sync/test/live_sync/two_client_apps_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698