| 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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Delegate* delegate, | 100 Delegate* delegate, |
| 101 Browser* browser) | 101 Browser* browser) |
| 102 : browser_(browser), | 102 : browser_(browser), |
| 103 user_action_(ACTION_BOUNDARY), | 103 user_action_(ACTION_BOUNDARY), |
| 104 delegate_(delegate), | 104 delegate_(delegate), |
| 105 initialized_(false), | 105 initialized_(false), |
| 106 did_highlight_(false) { | 106 did_highlight_(false) { |
| 107 } | 107 } |
| 108 | 108 |
| 109 ExtensionMessageBubbleController::~ExtensionMessageBubbleController() { | 109 ExtensionMessageBubbleController::~ExtensionMessageBubbleController() { |
| 110 if (did_highlight_) |
| 111 ToolbarActionsModel::Get(profile())->StopHighlighting(); |
| 110 } | 112 } |
| 111 | 113 |
| 112 Profile* ExtensionMessageBubbleController::profile() { | 114 Profile* ExtensionMessageBubbleController::profile() { |
| 113 return browser_->profile(); | 115 return browser_->profile(); |
| 114 } | 116 } |
| 115 | 117 |
| 116 bool ExtensionMessageBubbleController::ShouldShow() { | 118 bool ExtensionMessageBubbleController::ShouldShow() { |
| 117 std::set<Profile*>* profiles = GetProfileSet(); | 119 std::set<Profile*>* profiles = GetProfileSet(); |
| 118 return !profiles->count(profile()->GetOriginalProfile()) && | 120 return !profiles->count(profile()->GetOriginalProfile()) && |
| 119 !GetExtensionList().empty(); | 121 !GetExtensionList().empty(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void ExtensionMessageBubbleController::OnClose() { | 267 void ExtensionMessageBubbleController::OnClose() { |
| 266 DCHECK_NE(ACTION_BOUNDARY, user_action_); | 268 DCHECK_NE(ACTION_BOUNDARY, user_action_); |
| 267 // If the bubble was closed due to deactivation, don't treat it as | 269 // If the bubble was closed due to deactivation, don't treat it as |
| 268 // acknowledgment so that the user will see the bubble again (until they | 270 // acknowledgment so that the user will see the bubble again (until they |
| 269 // explicitly take an action). | 271 // explicitly take an action). |
| 270 if (user_action_ != ACTION_DISMISS_DEACTIVATION) { | 272 if (user_action_ != ACTION_DISMISS_DEACTIVATION) { |
| 271 AcknowledgeExtensions(); | 273 AcknowledgeExtensions(); |
| 272 if (delegate_->ClearProfileSetAfterAction()) | 274 if (delegate_->ClearProfileSetAfterAction()) |
| 273 GetProfileSet()->clear(); | 275 GetProfileSet()->clear(); |
| 274 } | 276 } |
| 275 | |
| 276 if (did_highlight_) | |
| 277 ToolbarActionsModel::Get(profile())->StopHighlighting(); | |
| 278 } | 277 } |
| 279 | 278 |
| 280 std::set<Profile*>* ExtensionMessageBubbleController::GetProfileSet() { | 279 std::set<Profile*>* ExtensionMessageBubbleController::GetProfileSet() { |
| 281 return &g_shown_for_profiles.Get()[delegate_->GetKey()]; | 280 return &g_shown_for_profiles.Get()[delegate_->GetKey()]; |
| 282 } | 281 } |
| 283 | 282 |
| 284 } // namespace extensions | 283 } // namespace extensions |
| OLD | NEW |