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

Side by Side Diff: chrome/browser/extensions/extension_message_bubble_controller.cc

Issue 1081113002: Revert of [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/extensions/extension_message_bubble_controller.h" 5 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_message_bubble.h" 10 #include "chrome/browser/extensions/extension_message_bubble.h"
11 #include "chrome/browser/extensions/extension_toolbar_model.h"
12 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
16 #include "content/public/browser/user_metrics.h" 15 #include "content/public/browser/user_metrics.h"
17 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
18 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
19 #include "grit/components_strings.h" 18 #include "grit/components_strings.h"
20 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
21 20
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 115 }
117 return return_value; 116 return return_value;
118 } 117 }
119 118
120 const ExtensionIdList& ExtensionMessageBubbleController::GetExtensionIdList() { 119 const ExtensionIdList& ExtensionMessageBubbleController::GetExtensionIdList() {
121 return *GetOrCreateExtensionList(); 120 return *GetOrCreateExtensionList();
122 } 121 }
123 122
124 bool ExtensionMessageBubbleController::CloseOnDeactivate() { return false; } 123 bool ExtensionMessageBubbleController::CloseOnDeactivate() { return false; }
125 124
126 void ExtensionMessageBubbleController::HighlightExtensionsIfNecessary() { 125 void ExtensionMessageBubbleController::Show(ExtensionMessageBubble* bubble) {
127 if (delegate_->ShouldHighlightExtensions()) { 126 // Wire up all the callbacks, to get notified what actions the user took.
128 const ExtensionIdList& extension_ids = GetExtensionIdList(); 127 base::Closure dismiss_button_callback =
129 DCHECK(!extension_ids.empty()); 128 base::Bind(&ExtensionMessageBubbleController::OnBubbleDismiss,
130 ExtensionToolbarModel::Get(profile_)->HighlightExtensions(extension_ids); 129 base::Unretained(this));
131 } 130 base::Closure action_button_callback =
132 } 131 base::Bind(&ExtensionMessageBubbleController::OnBubbleAction,
132 base::Unretained(this));
133 base::Closure link_callback =
134 base::Bind(&ExtensionMessageBubbleController::OnLinkClicked,
135 base::Unretained(this));
136 bubble->OnActionButtonClicked(action_button_callback);
137 bubble->OnDismissButtonClicked(dismiss_button_callback);
138 bubble->OnLinkClicked(link_callback);
133 139
134 void ExtensionMessageBubbleController::Show(ExtensionMessageBubble* bubble) {
135 bubble->Show(); 140 bubble->Show();
136 } 141 }
137 142
138 void ExtensionMessageBubbleController::OnBubbleAction() { 143 void ExtensionMessageBubbleController::OnBubbleAction() {
139 DCHECK_EQ(ACTION_BOUNDARY, user_action_); 144 DCHECK_EQ(ACTION_BOUNDARY, user_action_);
140 user_action_ = ACTION_EXECUTE; 145 user_action_ = ACTION_EXECUTE;
141 146
142 delegate_->LogAction(ACTION_EXECUTE); 147 delegate_->LogAction(ACTION_EXECUTE);
143 delegate_->PerformAction(*GetOrCreateExtensionList()); 148 delegate_->PerformAction(*GetOrCreateExtensionList());
144 AcknowledgeExtensions(); 149 AcknowledgeExtensions();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 205 }
201 206
202 delegate_->LogExtensionCount(extension_list_.size()); 207 delegate_->LogExtensionCount(extension_list_.size());
203 initialized_ = true; 208 initialized_ = true;
204 } 209 }
205 210
206 return &extension_list_; 211 return &extension_list_;
207 } 212 }
208 213
209 } // namespace extensions 214 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698