| 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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 MenuButton::ViewHierarchyChanged(is_add, parent, child); | 131 MenuButton::ViewHierarchyChanged(is_add, parent, child); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void BrowserActionButton::ButtonPressed(views::Button* sender, | 134 void BrowserActionButton::ButtonPressed(views::Button* sender, |
| 135 const views::Event& event) { | 135 const views::Event& event) { |
| 136 panel_->OnBrowserActionExecuted(this, false); | 136 panel_->OnBrowserActionExecuted(this, false); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void BrowserActionButton::OnImageLoaded(SkBitmap* image, | 139 void BrowserActionButton::OnImageLoaded(const gfx::Image& image, |
| 140 const ExtensionResource& resource, | 140 const std::string& extension_id, |
| 141 int index) { | 141 int index) { |
| 142 if (image) | 142 if (!image.IsEmpty()) |
| 143 default_icon_ = *image; | 143 default_icon_ = *image.ToSkBitmap(); |
| 144 | 144 |
| 145 // Call back to UpdateState() because a more specific icon might have been set | 145 // Call back to UpdateState() because a more specific icon might have been set |
| 146 // while the load was outstanding. | 146 // while the load was outstanding. |
| 147 UpdateState(); | 147 UpdateState(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void BrowserActionButton::UpdateState() { | 150 void BrowserActionButton::UpdateState() { |
| 151 int tab_id = panel_->GetCurrentTabId(); | 151 int tab_id = panel_->GetCurrentTabId(); |
| 152 if (tab_id < 0) | 152 if (tab_id < 0) |
| 153 return; | 153 return; |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 } | 1120 } |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1123 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1124 const Extension* extension) { | 1124 const Extension* extension) { |
| 1125 // Only display incognito-enabled extensions while in incognito mode. | 1125 // Only display incognito-enabled extensions while in incognito mode. |
| 1126 return | 1126 return |
| 1127 (!profile_->IsOffTheRecord() || | 1127 (!profile_->IsOffTheRecord() || |
| 1128 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1128 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
| 1129 } | 1129 } |
| OLD | NEW |