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

Side by Side Diff: chrome/browser/ui/views/infobars/extension_infobar.cc

Issue 6609047: [linux_views][Win] spoof proof redesign infobar extension with tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/infobars/extension_infobar.h" 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h"
6 6
7 #include "chrome/browser/extensions/extension_context_menu_model.h" 7 #include "chrome/browser/extensions/extension_context_menu_model.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" 9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/platform_util.h" 10 #include "chrome/browser/platform_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // When the infobar is closed, it animates to 0 vertical height. We'll 120 // When the infobar is closed, it animates to 0 vertical height. We'll
121 // continue to get size changed notifications from the ExtensionView, but we 121 // continue to get size changed notifications from the ExtensionView, but we
122 // need to ignore them otherwise we'll try to re-animate open (and leak the 122 // need to ignore them otherwise we'll try to re-animate open (and leak the
123 // infobar view). 123 // infobar view).
124 if (delegate->closing()) 124 if (delegate->closing())
125 return; 125 return;
126 126
127 view->SetVisible(true); 127 view->SetVisible(true);
128 128
129 if (height() == 0) 129 if (height() == 0)
130 animation()->Reset(0.0); 130 AnimationReset(0.0);
131 131
132 // Clamp height to a min and a max size of between 1 and 2 InfoBars. 132 // Clamp height to a min and a max size of between 1 and 2 InfoBars.
133 set_target_height(std::min(2 * kDefaultTargetHeight, 133 set_target_height(std::min(2 * kDefaultTargetHeight,
134 std::max(kDefaultTargetHeight, view->GetPreferredSize().height()))); 134 std::max(kDefaultTargetHeight, view->GetPreferredSize().height())));
135 135
136 animation()->Show(); 136 AnimationShow();
137 } 137 }
138 138
139 void ExtensionInfoBar::OnImageLoaded(SkBitmap* image, 139 void ExtensionInfoBar::OnImageLoaded(SkBitmap* image,
140 ExtensionResource resource, 140 ExtensionResource resource,
141 int index) { 141 int index) {
142 if (!GetDelegate()) 142 if (!GetDelegate())
143 return; // The delegate can go away while we asynchronously load images. 143 return; // The delegate can go away while we asynchronously load images.
144 144
145 SkBitmap* icon = image; 145 SkBitmap* icon = image;
146 // Fall back on the default extension icon on failure. 146 // Fall back on the default extension icon on failure.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 NULL); 184 NULL);
185 } 185 }
186 186
187 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); 187 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get()));
188 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); 188 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT);
189 } 189 }
190 190
191 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 191 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
192 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 192 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
193 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698