OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/extensions/disabled_extensions_view.h" | 5 #include "chrome/browser/ui/views/extensions/disabled_extensions_view.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 static bool done_showing_ui = false; | 74 static bool done_showing_ui = false; |
75 if (done_showing_ui) | 75 if (done_showing_ui) |
76 return; // Only show the bubble once per launch. | 76 return; // Only show the bubble once per launch. |
77 | 77 |
78 // A pref that counts how often the bubble has been shown. | 78 // A pref that counts how often the bubble has been shown. |
79 IntegerPrefMember sideload_wipeout_bubble_shown; | 79 IntegerPrefMember sideload_wipeout_bubble_shown; |
80 | 80 |
81 sideload_wipeout_bubble_shown.Init( | 81 sideload_wipeout_bubble_shown.Init( |
82 prefs::kExtensionsSideloadWipeoutBubbleShown, | 82 prefs::kExtensionsSideloadWipeoutBubbleShown, |
83 browser->profile()->GetPrefs(), NULL); | 83 browser->profile()->GetPrefs()); |
84 int bubble_shown_count = sideload_wipeout_bubble_shown.GetValue(); | 84 int bubble_shown_count = sideload_wipeout_bubble_shown.GetValue(); |
85 if (bubble_shown_count >= kShowSideloadWipeoutBubbleMax) | 85 if (bubble_shown_count >= kShowSideloadWipeoutBubbleMax) |
86 return; | 86 return; |
87 sideload_wipeout_bubble_shown.SetValue(++bubble_shown_count); | 87 sideload_wipeout_bubble_shown.SetValue(++bubble_shown_count); |
88 | 88 |
89 // Fetch all disabled extensions. | 89 // Fetch all disabled extensions. |
90 ExtensionService* extension_service = | 90 ExtensionService* extension_service = |
91 extensions::ExtensionSystem::Get( | 91 extensions::ExtensionSystem::Get( |
92 browser->profile())->extension_service(); | 92 browser->profile())->extension_service(); |
93 scoped_ptr<const ExtensionSet> wiped_out( | 93 scoped_ptr<const ExtensionSet> wiped_out( |
(...skipping 29 matching lines...) Expand all Loading... |
123 wiped_out->size()); | 123 wiped_out->size()); |
124 } | 124 } |
125 | 125 |
126 DisabledExtensionsView::~DisabledExtensionsView() { | 126 DisabledExtensionsView::~DisabledExtensionsView() { |
127 } | 127 } |
128 | 128 |
129 void DisabledExtensionsView::DismissBubble() { | 129 void DisabledExtensionsView::DismissBubble() { |
130 IntegerPrefMember sideload_wipeout_bubble_shown; | 130 IntegerPrefMember sideload_wipeout_bubble_shown; |
131 sideload_wipeout_bubble_shown.Init( | 131 sideload_wipeout_bubble_shown.Init( |
132 prefs::kExtensionsSideloadWipeoutBubbleShown, | 132 prefs::kExtensionsSideloadWipeoutBubbleShown, |
133 browser_->profile()->GetPrefs(), NULL); | 133 browser_->profile()->GetPrefs()); |
134 sideload_wipeout_bubble_shown.SetValue(kShowSideloadWipeoutBubbleMax); | 134 sideload_wipeout_bubble_shown.SetValue(kShowSideloadWipeoutBubbleMax); |
135 | 135 |
136 GetWidget()->Close(); | 136 GetWidget()->Close(); |
137 content::RecordAction( | 137 content::RecordAction( |
138 UserMetricsAction("DisabledExtensionNotificationDismissed")); | 138 UserMetricsAction("DisabledExtensionNotificationDismissed")); |
139 } | 139 } |
140 | 140 |
141 void DisabledExtensionsView::ButtonPressed(views::Button* sender, | 141 void DisabledExtensionsView::ButtonPressed(views::Button* sender, |
142 const ui::Event& event) { | 142 const ui::Event& event) { |
143 if (sender == settings_button_) { | 143 if (sender == settings_button_) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 layout->AddView(settings_button_); | 313 layout->AddView(settings_button_); |
314 dismiss_button_ = new views::NativeTextButton(this, | 314 dismiss_button_ = new views::NativeTextButton(this, |
315 l10n_util::GetStringUTF16(IDS_OPTIONS_SIDELOAD_WIPEOUT_DISMISS)); | 315 l10n_util::GetStringUTF16(IDS_OPTIONS_SIDELOAD_WIPEOUT_DISMISS)); |
316 dismiss_button_->SetFont( | 316 dismiss_button_->SetFont( |
317 dismiss_button_->font().DeriveFont(0, gfx::Font::BOLD)); | 317 dismiss_button_->font().DeriveFont(0, gfx::Font::BOLD)); |
318 layout->AddView(dismiss_button_); | 318 layout->AddView(dismiss_button_); |
319 | 319 |
320 content::RecordAction( | 320 content::RecordAction( |
321 UserMetricsAction("DisabledExtensionNotificationShown")); | 321 UserMetricsAction("DisabledExtensionNotificationShown")); |
322 } | 322 } |
OLD | NEW |