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

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

Issue 15969017: Warn by default when certain DLL conflicts exist on XP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Freshly sync'ed Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/conflicting_module_view_win.cc ('k') | chrome/chrome_browser_ui.gypi » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/i18n/number_formatting.h" 8 #include "base/i18n/number_formatting.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "ui/gfx/canvas.h" 53 #include "ui/gfx/canvas.h"
54 #include "ui/gfx/image/canvas_image_source.h" 54 #include "ui/gfx/image/canvas_image_source.h"
55 #include "ui/views/controls/button/button_dropdown.h" 55 #include "ui/views/controls/button/button_dropdown.h"
56 #include "ui/views/controls/menu/menu_listener.h" 56 #include "ui/views/controls/menu/menu_listener.h"
57 #include "ui/views/focus/view_storage.h" 57 #include "ui/views/focus/view_storage.h"
58 #include "ui/views/widget/tooltip_manager.h" 58 #include "ui/views/widget/tooltip_manager.h"
59 #include "ui/views/widget/widget.h" 59 #include "ui/views/widget/widget.h"
60 #include "ui/views/window/non_client_view.h" 60 #include "ui/views/window/non_client_view.h"
61 61
62 #if defined(OS_WIN) 62 #if defined(OS_WIN)
63 #include "base/win/windows_version.h"
63 #include "chrome/browser/enumerate_modules_model_win.h" 64 #include "chrome/browser/enumerate_modules_model_win.h"
65 #include "chrome/browser/ui/views/conflicting_module_view_win.h"
64 #include "chrome/browser/ui/views/critical_notification_bubble_view.h" 66 #include "chrome/browser/ui/views/critical_notification_bubble_view.h"
65 #if !defined(USE_AURA) 67 #if !defined(USE_AURA)
66 #include "chrome/browser/ui/views/app_menu_button_win.h" 68 #include "chrome/browser/ui/views/app_menu_button_win.h"
67 #endif 69 #endif
68 #endif 70 #endif
69 71
70 #if defined(USE_AURA) 72 #if defined(USE_AURA)
71 #include "ui/aura/window.h" 73 #include "ui/aura/window.h"
72 #include "ui/compositor/layer.h" 74 #include "ui/compositor/layer.h"
73 #include "ui/native_theme/native_theme_aura.h" 75 #include "ui/native_theme/native_theme_aura.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 170
169 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 171 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
170 content::NotificationService::AllSources()); 172 content::NotificationService::AllSources());
171 if (OutdatedUpgradeBubbleView::IsAvailable()) { 173 if (OutdatedUpgradeBubbleView::IsAvailable()) {
172 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL, 174 registrar_.Add(this, chrome::NOTIFICATION_OUTDATED_INSTALL,
173 content::NotificationService::AllSources()); 175 content::NotificationService::AllSources());
174 } 176 }
175 #if defined(OS_WIN) 177 #if defined(OS_WIN)
176 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED, 178 registrar_.Add(this, chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED,
177 content::NotificationService::AllSources()); 179 content::NotificationService::AllSources());
180 if (base::win::GetVersion() == base::win::VERSION_XP) {
181 registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED,
182 content::NotificationService::AllSources());
183 }
178 #endif 184 #endif
179 registrar_.Add(this, 185 registrar_.Add(this,
180 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 186 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
181 content::NotificationService::AllSources()); 187 content::NotificationService::AllSources());
182 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, 188 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
183 content::Source<Profile>(browser_->profile())); 189 content::Source<Profile>(browser_->profile()));
184 } 190 }
185 191
186 ToolbarView::~ToolbarView() { 192 ToolbarView::~ToolbarView() {
187 // NOTE: Don't remove the command observers here. This object gets destroyed 193 // NOTE: Don't remove the command observers here. This object gets destroyed
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 //////////////////////////////////////////////////////////////////////////////// 460 ////////////////////////////////////////////////////////////////////////////////
455 // ToolbarView, content::NotificationObserver implementation: 461 // ToolbarView, content::NotificationObserver implementation:
456 462
457 void ToolbarView::Observe(int type, 463 void ToolbarView::Observe(int type,
458 const content::NotificationSource& source, 464 const content::NotificationSource& source,
459 const content::NotificationDetails& details) { 465 const content::NotificationDetails& details) {
460 switch (type) { 466 switch (type) {
461 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: 467 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED:
462 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE: 468 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE:
463 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 469 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
470 case chrome::NOTIFICATION_MODULE_LIST_ENUMERATED:
464 UpdateAppMenuState(); 471 UpdateAppMenuState();
465 break; 472 break;
466 case chrome::NOTIFICATION_OUTDATED_INSTALL: 473 case chrome::NOTIFICATION_OUTDATED_INSTALL:
467 ShowOutdatedInstallNotification(); 474 ShowOutdatedInstallNotification();
468 break; 475 break;
469 #if defined(OS_WIN) 476 #if defined(OS_WIN)
470 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED: 477 case chrome::NOTIFICATION_CRITICAL_UPGRADE_INSTALLED:
471 ShowCriticalNotification(); 478 ShowCriticalNotification();
472 break; 479 break;
473 #endif 480 #endif
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 // should not be displayed in the wrench menu. 703 // should not be displayed in the wrench menu.
697 return false; 704 return false;
698 #else 705 #else
699 return (UpgradeDetector::GetInstance()->notify_upgrade()); 706 return (UpgradeDetector::GetInstance()->notify_upgrade());
700 #endif 707 #endif
701 } 708 }
702 709
703 bool ToolbarView::ShouldShowIncompatibilityWarning() { 710 bool ToolbarView::ShouldShowIncompatibilityWarning() {
704 #if defined(OS_WIN) 711 #if defined(OS_WIN)
705 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); 712 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance();
713 loaded_modules->MaybePostScanningTask();
706 return loaded_modules->ShouldShowConflictWarning(); 714 return loaded_modules->ShouldShowConflictWarning();
707 #else 715 #else
708 return false; 716 return false;
709 #endif 717 #endif
710 } 718 }
711 719
712 int ToolbarView::PopupTopSpacing() const { 720 int ToolbarView::PopupTopSpacing() const {
713 const int kPopupTopSpacingNonGlass = 3; 721 const int kPopupTopSpacingNonGlass = 3;
714 return GetWidget()->ShouldUseNativeFrame() ? 0 : kPopupTopSpacingNonGlass; 722 return GetWidget()->ShouldUseNativeFrame() ? 0 : kPopupTopSpacingNonGlass;
715 } 723 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 789
782 if (ShouldShowUpgradeRecommended()) { 790 if (ShouldShowUpgradeRecommended()) {
783 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level = 791 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level =
784 UpgradeDetector::GetInstance()->upgrade_notification_stage(); 792 UpgradeDetector::GetInstance()->upgrade_notification_stage();
785 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromUpgradeLevel(level), 793 app_menu_->SetSeverity(WrenchIconPainter::SeverityFromUpgradeLevel(level),
786 WrenchIconPainter::ShouldAnimateUpgradeLevel(level)); 794 WrenchIconPainter::ShouldAnimateUpgradeLevel(level));
787 return; 795 return;
788 } 796 }
789 797
790 if (ShouldShowIncompatibilityWarning()) { 798 if (ShouldShowIncompatibilityWarning()) {
791 if (!was_showing) 799 if (!was_showing) {
792 content::RecordAction(UserMetricsAction("ConflictBadge")); 800 content::RecordAction(UserMetricsAction("ConflictBadge"));
801 #if defined(OS_WIN)
802 ConflictingModuleView::MaybeShow(browser_, app_menu_);
803 #endif
804 }
793 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_MEDIUM, true); 805 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_MEDIUM, true);
794 incompatibility_badge_showing = true; 806 incompatibility_badge_showing = true;
795 return; 807 return;
796 } 808 }
797 809
798 GlobalErrorService* service = 810 GlobalErrorService* service =
799 GlobalErrorServiceFactory::GetForProfile(browser_->profile()); 811 GlobalErrorServiceFactory::GetForProfile(browser_->profile());
800 GlobalError* error = 812 GlobalError* error =
801 service->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); 813 service->GetHighestSeverityGlobalErrorWithWrenchMenuItem();
802 if (error) { 814 if (error) {
803 app_menu_->SetSeverity(WrenchIconPainter::GlobalErrorSeverity(), true); 815 app_menu_->SetSeverity(WrenchIconPainter::GlobalErrorSeverity(), true);
804 return; 816 return;
805 } 817 }
806 818
807 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_NONE, true); 819 app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_NONE, true);
808 } 820 }
809 821
810 void ToolbarView::OnShowHomeButtonChanged() { 822 void ToolbarView::OnShowHomeButtonChanged() {
811 Layout(); 823 Layout();
812 SchedulePaint(); 824 SchedulePaint();
813 } 825 }
814 826
815 int ToolbarView::content_shadow_height() const { 827 int ToolbarView::content_shadow_height() const {
816 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 828 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
817 kContentShadowHeightAsh : kContentShadowHeight; 829 kContentShadowHeightAsh : kContentShadowHeight;
818 } 830 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/conflicting_module_view_win.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698