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

Side by Side Diff: chrome/browser/ui/views/outdated_upgrade_bubble_view.cc

Issue 216153006: Invoke setup.exe to reenable updates when the update bubble is clicked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mad2
Patch Set: MAD's feedback. Created 6 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/views/outdated_upgrade_bubble_view.h" 5 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #endif 9 #endif
10 10
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/upgrade_detector.h" 15 #include "chrome/browser/upgrade_detector.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/installer/util/google_update_util.h"
18 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/page_navigator.h" 19 #include "content/public/browser/page_navigator.h"
18 #include "content/public/browser/user_metrics.h" 20 #include "content/public/browser/user_metrics.h"
19 #include "grit/chromium_strings.h" 21 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
21 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/views/controls/button/label_button.h" 26 #include "ui/views/controls/button/label_button.h"
25 #include "ui/views/controls/image_view.h" 27 #include "ui/views/controls/image_view.h"
26 #include "ui/views/controls/label.h" 28 #include "ui/views/controls/label.h"
27 #include "ui/views/layout/grid_layout.h" 29 #include "ui/views/layout/grid_layout.h"
28 #include "ui/views/layout/layout_constants.h" 30 #include "ui/views/layout/layout_constants.h"
29 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
30 #include "url/gurl.h" 32 #include "url/gurl.h"
31 33
32 #if defined(OS_WIN) 34 #if defined(OS_WIN)
33 #include "base/win/win_util.h" 35 #include "base/win/win_util.h"
34 #include "base/win/windows_version.h" 36 #include "base/win/windows_version.h"
35 #include "chrome/installer/util/install_util.h" 37 #include "chrome/installer/util/install_util.h"
36 #include "ui/gfx/icon_util.h" 38 #include "ui/gfx/icon_util.h"
37 #endif 39 #endif
38 40
41 using content::BrowserThread;
39 using views::GridLayout; 42 using views::GridLayout;
40 43
41 namespace { 44 namespace {
42 45
43 // Fixed width of the column holding the description label of the bubble. 46 // Fixed width of the column holding the description label of the bubble.
44 // TODO(mad): Make sure there is enough room for all languages. 47 // TODO(mad): Make sure there is enough room for all languages.
45 const int kWidthOfDescriptionText = 330; 48 const int kWidthOfDescriptionText = 330;
46 49
47 // We subtract 2 to account for the natural button padding, and 50 // We subtract 2 to account for the natural button padding, and
48 // to bring the separation visually in line with the row separation 51 // to bring the separation visually in line with the row separation
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 NEW_FOREGROUND_TAB, 258 NEW_FOREGROUND_TAB,
256 content::PAGE_TRANSITION_LINK, 259 content::PAGE_TRANSITION_LINK,
257 false)); 260 false));
258 } else { 261 } else {
259 DCHECK(UpgradeDetector::GetInstance()->is_outdated_install_no_au()); 262 DCHECK(UpgradeDetector::GetInstance()->is_outdated_install_no_au());
260 UMA_HISTOGRAM_CUSTOM_COUNTS( 263 UMA_HISTOGRAM_CUSTOM_COUNTS(
261 "OutdatedUpgradeBubble.NumLaterPerEnableAU", num_ignored_bubbles_, 264 "OutdatedUpgradeBubble.NumLaterPerEnableAU", num_ignored_bubbles_,
262 0, kMaxIgnored, kNumIgnoredBuckets); 265 0, kMaxIgnored, kNumIgnoredBuckets);
263 content::RecordAction( 266 content::RecordAction(
264 base::UserMetricsAction("OutdatedUpgradeBubble.EnableAU")); 267 base::UserMetricsAction("OutdatedUpgradeBubble.EnableAU"));
265 // TODO(robertshield): Make a call to GoogleUpdateSettings to enable 268 // Record that the autoupdate flavour of the dialog has been shown.
266 // auto-update.
267 if (g_browser_process->local_state()) { 269 if (g_browser_process->local_state()) {
268 g_browser_process->local_state()->SetBoolean( 270 g_browser_process->local_state()->SetBoolean(
269 prefs::kAttemptedToEnableAutoupdate, true); 271 prefs::kAttemptedToEnableAutoupdate, true);
270 } 272 }
273
274 // Re-enable updates by shelling out to setup.exe on the file thread.
grt (UTC plus 2) 2014/03/28 21:22:21 is the blocking pool not a better place for this?
275 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
276 base::Bind(&google_update::ElevateIfNeededToReenableUpdates));
271 } 277 }
272 } else { 278 } else {
273 DCHECK_EQ(later_button_, sender); 279 DCHECK_EQ(later_button_, sender);
274 content::RecordAction( 280 content::RecordAction(
275 base::UserMetricsAction("OutdatedUpgradeBubble.Later")); 281 base::UserMetricsAction("OutdatedUpgradeBubble.Later"));
276 } 282 }
277 GetWidget()->Close(); 283 GetWidget()->Close();
278 } 284 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/setup_main.cc » ('j') | chrome/installer/util/google_update_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698