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

Side by Side Diff: chrome/browser/sync/glue/theme_util.cc

Issue 2819023: Reworked ExtensionsService::AddPendingExtension(). (Closed)
Patch Set: Fixed browsertest test failure Created 10 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
« no previous file with comments | « chrome/browser/sync/glue/extension_model_associator.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/glue/theme_util.h" 5 #include "chrome/browser/sync/glue/theme_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // just set the current theme to it. 120 // just set the current theme to it.
121 profile->SetTheme(extension); 121 profile->SetTheme(extension);
122 // Pretend the theme was just installed. 122 // Pretend the theme was just installed.
123 ExtensionInstallUI::ShowThemeInfoBar( 123 ExtensionInstallUI::ShowThemeInfoBar(
124 previous_theme_id, previous_use_system_theme, 124 previous_theme_id, previous_use_system_theme,
125 extension, profile); 125 extension, profile);
126 } else { 126 } else {
127 // No extension with this id exists -- we must install it; we do 127 // No extension with this id exists -- we must install it; we do
128 // so by adding it as a pending extension and then triggering an 128 // so by adding it as a pending extension and then triggering an
129 // auto-update cycle. 129 // auto-update cycle.
130 scoped_ptr<Version> version(Version::GetVersionFromString("0.0.0.0"));
131 DCHECK(version.get());
132 const bool kIsTheme = true; 130 const bool kIsTheme = true;
133 // Themes don't need to install silently as they just pop up an 131 // Themes don't need to install silently as they just pop up an
134 // informational dialog after installation instead of a 132 // informational dialog after installation instead of a
135 // confirmation dialog. 133 // confirmation dialog.
136 const bool kInstallSilently = false; 134 const bool kInstallSilently = false;
137 extensions_service->AddPendingExtension(id, update_url, *version, 135 const bool kEnableOnInstall = true;
138 kIsTheme, kInstallSilently); 136 const bool kEnableIncognitoOnInstall = false;
137 extensions_service->AddPendingExtension(
138 id, update_url, kIsTheme, kInstallSilently,
139 kEnableOnInstall, kEnableIncognitoOnInstall);
139 ExtensionUpdater* extension_updater = extensions_service->updater(); 140 ExtensionUpdater* extension_updater = extensions_service->updater();
140 // Auto-updates should now be on always (see the construction of 141 // Auto-updates should now be on always (see the construction of
141 // the ExtensionsService in ProfileImpl::InitExtensions()). 142 // the ExtensionsService in ProfileImpl::InitExtensions()).
142 if (!extension_updater) { 143 if (!extension_updater) {
143 LOG(DFATAL) << "Extension updater unexpectedly NULL; " 144 LOG(DFATAL) << "Extension updater unexpectedly NULL; "
144 << "auto-updates may be turned off"; 145 << "auto-updates may be turned off";
145 return; 146 return;
146 } 147 }
147 extension_updater->CheckNow(); 148 extension_updater->CheckNow();
148 } 149 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const sync_pb::ThemeSpecifics& theme_specifics, Profile* profile) { 201 const sync_pb::ThemeSpecifics& theme_specifics, Profile* profile) {
201 DCHECK(profile); 202 DCHECK(profile);
202 sync_pb::ThemeSpecifics old_theme_specifics; 203 sync_pb::ThemeSpecifics old_theme_specifics;
203 GetThemeSpecificsFromCurrentTheme(profile, &old_theme_specifics); 204 GetThemeSpecificsFromCurrentTheme(profile, &old_theme_specifics);
204 if (!AreThemeSpecificsEqual(old_theme_specifics, theme_specifics)) { 205 if (!AreThemeSpecificsEqual(old_theme_specifics, theme_specifics)) {
205 SetCurrentThemeFromThemeSpecifics(theme_specifics, profile); 206 SetCurrentThemeFromThemeSpecifics(theme_specifics, profile);
206 } 207 }
207 } 208 }
208 209
209 } // namespace browser_sync 210 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/extension_model_associator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698