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

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

Issue 8142028: When critical updates have been installed and the user has been idle for quite some time, show a ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | chrome/browser/upgrade_detector.h » ('j') | 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) 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/ui/views/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 25 matching lines...) Expand all
36 #include "ui/gfx/canvas_skia.h" 36 #include "ui/gfx/canvas_skia.h"
37 #include "ui/gfx/skbitmap_operations.h" 37 #include "ui/gfx/skbitmap_operations.h"
38 #include "views/controls/button/button_dropdown.h" 38 #include "views/controls/button/button_dropdown.h"
39 #include "views/controls/menu/menu_listener.h" 39 #include "views/controls/menu/menu_listener.h"
40 #include "views/focus/view_storage.h" 40 #include "views/focus/view_storage.h"
41 #include "views/widget/tooltip_manager.h" 41 #include "views/widget/tooltip_manager.h"
42 #include "views/window/non_client_view.h" 42 #include "views/window/non_client_view.h"
43 43
44 #if defined(OS_WIN) 44 #if defined(OS_WIN)
45 #include "chrome/browser/enumerate_modules_model_win.h" 45 #include "chrome/browser/enumerate_modules_model_win.h"
46 #include "chrome/browser/ui/views/critical_notification_bubble_view.h"
46 #if !defined(USE_AURA) 47 #if !defined(USE_AURA)
47 #include "chrome/browser/ui/views/app_menu_button_win.h" 48 #include "chrome/browser/ui/views/app_menu_button_win.h"
48 #endif 49 #endif
49 #endif 50 #endif
50 51
51 // static 52 // static
52 char ToolbarView::kViewClassName[] = "browser/ui/views/ToolbarView"; 53 char ToolbarView::kViewClassName[] = "browser/ui/views/ToolbarView";
53 // The space between items is 4 px in general. 54 // The space between items is 4 px in general.
54 const int ToolbarView::kStandardSpacing = 4; 55 const int ToolbarView::kStandardSpacing = 4;
55 // The top of the toolbar has an edge we have to skip over in addition to the 4 56 // The top of the toolbar has an edge we have to skip over in addition to the 4
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? 109 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
109 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; 110 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION;
110 111
111 if (!kPopupBackgroundEdge) { 112 if (!kPopupBackgroundEdge) {
112 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( 113 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed(
113 IDR_LOCATIONBG_POPUPMODE_EDGE); 114 IDR_LOCATIONBG_POPUPMODE_EDGE);
114 } 115 }
115 116
116 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 117 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
117 NotificationService::AllSources()); 118 NotificationService::AllSources());
119 #if defined(OS_WIN) && !defined(USE_AURA)
120 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED,
121 NotificationService::AllSources());
122 #endif
118 registrar_.Add(this, 123 registrar_.Add(this,
119 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 124 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
120 NotificationService::AllSources()); 125 NotificationService::AllSources());
121 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, 126 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
122 Source<Profile>(browser_->profile())); 127 Source<Profile>(browser_->profile()));
123 } 128 }
124 129
125 ToolbarView::~ToolbarView() { 130 ToolbarView::~ToolbarView() {
126 // NOTE: Don't remove the command observers here. This object gets destroyed 131 // NOTE: Don't remove the command observers here. This object gets destroyed
127 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is 132 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 Layout(); 419 Layout();
415 SchedulePaint(); 420 SchedulePaint();
416 } 421 }
417 break; 422 break;
418 } 423 }
419 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: 424 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED:
420 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: 425 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE:
421 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 426 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
422 UpdateAppMenuBadge(); 427 UpdateAppMenuBadge();
423 break; 428 break;
429 #if defined(OS_WIN) && !defined(USE_AURA)
430 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED:
431 ShowCriticalNotification();
432 break;
433 #endif
424 default: 434 default:
425 NOTREACHED(); 435 NOTREACHED();
426 } 436 }
427 } 437 }
428 438
429 //////////////////////////////////////////////////////////////////////////////// 439 ////////////////////////////////////////////////////////////////////////////////
430 // ToolbarView, ui::AcceleratorProvider implementation: 440 // ToolbarView, ui::AcceleratorProvider implementation:
431 441
432 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 442 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
433 ui::Accelerator* accelerator) { 443 ui::Accelerator* accelerator) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 home_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_HOME)); 714 home_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_HOME));
705 home_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_HOME_H)); 715 home_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_HOME_H));
706 home_->SetImage(views::CustomButton::BS_PUSHED, 716 home_->SetImage(views::CustomButton::BS_PUSHED,
707 tp->GetBitmapNamed(IDR_HOME_P)); 717 tp->GetBitmapNamed(IDR_HOME_P));
708 718
709 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 719 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
710 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 720 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
711 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 721 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
712 } 722 }
713 723
724 void ToolbarView::ShowCriticalNotification() {
725 #if defined(OS_WIN) && !defined(USE_AURA)
726 gfx::Point screen_loc;
727 views::View::ConvertPointToScreen(app_menu_, &screen_loc);
728
729 CriticalNotificationBubbleView* critical_notification_bubble =
730 new CriticalNotificationBubbleView();
731 Bubble* bubble = Bubble::Show(GetWidget(),
732 gfx::Rect(screen_loc, app_menu_->size()),
733 views::BubbleBorder::TOP_RIGHT,
734 critical_notification_bubble,
735 critical_notification_bubble);
736 bubble->set_close_on_deactivate(false);
737 critical_notification_bubble->set_bubble(bubble);
738 #endif
739 }
740
714 void ToolbarView::UpdateAppMenuBadge() { 741 void ToolbarView::UpdateAppMenuBadge() {
715 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 742 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
716 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 743 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
717 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 744 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
718 SchedulePaint(); 745 SchedulePaint();
719 } 746 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | chrome/browser/upgrade_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698