| OLD | NEW |
| 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/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/extension_message_bubble.h" | 12 #include "chrome/browser/extensions/extension_message_bubble.h" |
| 13 #include "chrome/browser/extensions/extension_toolbar_model.h" | |
| 14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| 17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 18 #include "content/public/browser/user_metrics.h" | 18 #include "content/public/browser/user_metrics.h" |
| 19 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
| 20 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
| 21 #include "grit/components_strings.h" | 21 #include "grit/components_strings.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return *GetOrCreateExtensionList(); | 148 return *GetOrCreateExtensionList(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool ExtensionMessageBubbleController::CloseOnDeactivate() { return false; } | 151 bool ExtensionMessageBubbleController::CloseOnDeactivate() { return false; } |
| 152 | 152 |
| 153 void ExtensionMessageBubbleController::HighlightExtensionsIfNecessary() { | 153 void ExtensionMessageBubbleController::HighlightExtensionsIfNecessary() { |
| 154 if (delegate_->ShouldHighlightExtensions() && !did_highlight_) { | 154 if (delegate_->ShouldHighlightExtensions() && !did_highlight_) { |
| 155 did_highlight_ = true; | 155 did_highlight_ = true; |
| 156 const ExtensionIdList& extension_ids = GetExtensionIdList(); | 156 const ExtensionIdList& extension_ids = GetExtensionIdList(); |
| 157 DCHECK(!extension_ids.empty()); | 157 DCHECK(!extension_ids.empty()); |
| 158 ExtensionToolbarModel::Get(profile_)->HighlightExtensions( | 158 ToolbarActionsModel::Get(profile_)->HighlightActions( |
| 159 extension_ids, ExtensionToolbarModel::HIGHLIGHT_WARNING); | 159 extension_ids, ToolbarActionsModel::HIGHLIGHT_WARNING); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 void ExtensionMessageBubbleController::Show(ExtensionMessageBubble* bubble) { | 163 void ExtensionMessageBubbleController::Show(ExtensionMessageBubble* bubble) { |
| 164 bubble->Show(); | 164 bubble->Show(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void ExtensionMessageBubbleController::OnBubbleAction() { | 167 void ExtensionMessageBubbleController::OnBubbleAction() { |
| 168 DCHECK_EQ(ACTION_BOUNDARY, user_action_); | 168 DCHECK_EQ(ACTION_BOUNDARY, user_action_); |
| 169 user_action_ = ACTION_EXECUTE; | 169 user_action_ = ACTION_EXECUTE; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 delegate_->LogExtensionCount(extension_list_.size()); | 230 delegate_->LogExtensionCount(extension_list_.size()); |
| 231 initialized_ = true; | 231 initialized_ = true; |
| 232 } | 232 } |
| 233 | 233 |
| 234 return &extension_list_; | 234 return &extension_list_; |
| 235 } | 235 } |
| 236 | 236 |
| 237 void ExtensionMessageBubbleController::OnClose() { | 237 void ExtensionMessageBubbleController::OnClose() { |
| 238 AcknowledgeExtensions(); | 238 AcknowledgeExtensions(); |
| 239 if (did_highlight_) | 239 if (did_highlight_) |
| 240 ExtensionToolbarModel::Get(profile_)->StopHighlighting(); | 240 ToolbarActionsModel::Get(profile_)->StopHighlighting(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |