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

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

Issue 2037883004: [Win] Add reporting of total number of modules loaded in browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 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
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/conflicting_module_view_win.h" 5 #include "chrome/browser/ui/views/conflicting_module_view_win.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/layout_constants.h" 11 #include "chrome/browser/ui/layout_constants.h"
12 #include "chrome/browser/win/enumerate_modules_model.h"
13 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
14 #include "chrome/grit/chromium_strings.h" 13 #include "chrome/grit/chromium_strings.h"
15 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
16 #include "chrome/grit/locale_settings.h" 15 #include "chrome/grit/locale_settings.h"
17 #include "chrome/grit/theme_resources.h" 16 #include "chrome/grit/theme_resources.h"
18 #include "components/strings/grit/components_strings.h" 17 #include "components/strings/grit/components_strings.h"
19 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/user_metrics.h" 19 #include "content/public/browser/user_metrics.h"
21 #include "ui/accessibility/ax_view_state.h" 20 #include "ui/accessibility/ax_view_state.h"
22 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
(...skipping 14 matching lines...) Expand all
37 } // namespace 36 } // namespace
38 37
39 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
40 // ConflictingModuleView 39 // ConflictingModuleView
41 40
42 ConflictingModuleView::ConflictingModuleView(views::View* anchor_view, 41 ConflictingModuleView::ConflictingModuleView(views::View* anchor_view,
43 Browser* browser, 42 Browser* browser,
44 const GURL& help_center_url) 43 const GURL& help_center_url)
45 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 44 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
46 browser_(browser), 45 browser_(browser),
46 observer_(this),
47 help_center_url_(help_center_url) { 47 help_center_url_(help_center_url) {
48 set_close_on_deactivate(false); 48 set_close_on_deactivate(false);
49 49
50 // Compensate for built-in vertical padding in the anchor view's image. 50 // Compensate for built-in vertical padding in the anchor view's image.
51 set_anchor_view_insets(gfx::Insets( 51 set_anchor_view_insets(gfx::Insets(
52 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 52 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
53 53
54 registrar_.Add(this, chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_ICON_CHANGE, 54 observer_.Add(EnumerateModulesModel::GetInstance());
55 content::NotificationService::AllSources());
56 } 55 }
57 56
58 // static 57 // static
59 void ConflictingModuleView::MaybeShow(Browser* browser, 58 void ConflictingModuleView::MaybeShow(Browser* browser,
60 views::View* anchor_view) { 59 views::View* anchor_view) {
61 static bool done_checking = false; 60 static bool done_checking = false;
62 if (done_checking) 61 if (done_checking)
63 return; // Only show the bubble once per launch. 62 return; // Only show the bubble once per launch.
64 63
65 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); 64 auto* model = EnumerateModulesModel::GetInstance();
66 GURL url = model->GetFirstNotableConflict(); 65 GURL url = model->GetConflictUrl();
67 if (!url.is_valid()) { 66 if (!url.is_valid()) {
68 done_checking = true; 67 done_checking = true;
69 return; 68 return;
70 } 69 }
71 70
72 // A pref that counts how often the Sideload Wipeout bubble has been shown. 71 // A pref that counts how often the Sideload Wipeout bubble has been shown.
73 IntegerPrefMember bubble_shown; 72 IntegerPrefMember bubble_shown;
74 bubble_shown.Init(prefs::kModuleConflictBubbleShown, 73 bubble_shown.Init(prefs::kModuleConflictBubbleShown,
75 browser->profile()->GetPrefs()); 74 browser->profile()->GetPrefs());
76 if (bubble_shown.GetValue() >= kShowConflictingModuleBubbleMax) { 75 if (bubble_shown.GetValue() >= kShowConflictingModuleBubbleMax) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 UMA_HISTOGRAM_ENUMERATION("ConflictingModule.UserSelection", 155 UMA_HISTOGRAM_ENUMERATION("ConflictingModule.UserSelection",
157 EnumerateModulesModel::ACTION_BUBBLE_SHOWN, 156 EnumerateModulesModel::ACTION_BUBBLE_SHOWN,
158 EnumerateModulesModel::ACTION_BOUNDARY); 157 EnumerateModulesModel::ACTION_BOUNDARY);
159 } 158 }
160 159
161 void ConflictingModuleView::GetAccessibleState( 160 void ConflictingModuleView::GetAccessibleState(
162 ui::AXViewState* state) { 161 ui::AXViewState* state) {
163 state->role = ui::AX_ROLE_ALERT_DIALOG; 162 state->role = ui::AX_ROLE_ALERT_DIALOG;
164 } 163 }
165 164
166 void ConflictingModuleView::Observe( 165 void ConflictingModuleView::OnConflictsAcknowledged() {
167 int type,
168 const content::NotificationSource& source,
169 const content::NotificationDetails& details) {
170 DCHECK_EQ(chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_ICON_CHANGE, type);
171 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); 166 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance();
172 if (!model->ShouldShowConflictWarning()) 167 if (!model->ShouldShowConflictWarning())
173 GetWidget()->Close(); 168 GetWidget()->Close();
174 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/conflicting_module_view_win.h ('k') | chrome/browser/ui/webui/conflicts_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698