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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 6544020: Correct browser action popup regression (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/extension_popup.h" 5 #include "chrome/browser/ui/views/extensions/extension_popup.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "chrome/browser/debugger/devtools_manager.h" 9 #include "chrome/browser/debugger/devtools_manager.h"
10 #include "chrome/browser/debugger/devtools_toggle_action.h" 10 #include "chrome/browser/debugger/devtools_toggle_action.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Show the border first, then the popup overlaid on top. 149 // Show the border first, then the popup overlaid on top.
150 border_widget_->Show(); 150 border_widget_->Show();
151 BrowserBubble::Show(activate); 151 BrowserBubble::Show(activate);
152 } 152 }
153 153
154 void ExtensionPopup::ResizeToView() { 154 void ExtensionPopup::ResizeToView() {
155 // We'll be sizing ourselves to this size shortly, but wait until we 155 // We'll be sizing ourselves to this size shortly, but wait until we
156 // know our position to do it. 156 // know our position to do it.
157 gfx::Size new_size = view()->size(); 157 gfx::Size new_size = view()->size();
158 158
159 // |relative_to_| is in browser-relative coordinates, so convert it to
160 // screen coordinates for use placing the popup widgets.
rafaelw 2011/02/18 22:13:22 for use in placing
Jeff Timanus 2011/02/18 22:23:35 Done.
161 gfx::Rect relative_rect = relative_to_;
162 gfx::Point relative_origin = relative_rect.origin();
163 views::View::ConvertPointToScreen(frame_->GetRootView(), &relative_origin);
164 relative_rect.set_origin(relative_origin);
165
159 // The rounded corners cut off more of the view than the border insets claim. 166 // The rounded corners cut off more of the view than the border insets claim.
160 // Since we can't clip the ExtensionView's corners, we need to increase the 167 // Since we can't clip the ExtensionView's corners, we need to increase the
161 // inset by half the corner radius as well as lying about the size of the 168 // inset by half the corner radius as well as lying about the size of the
162 // contents size to compensate. 169 // contents size to compensate.
163 int corner_inset = BubbleBorder::GetCornerRadius() / 2; 170 int corner_inset = BubbleBorder::GetCornerRadius() / 2;
164 gfx::Size adjusted_size = new_size; 171 gfx::Size adjusted_size = new_size;
165 adjusted_size.Enlarge(2 * corner_inset, 2 * corner_inset); 172 adjusted_size.Enlarge(2 * corner_inset, 2 * corner_inset);
166 gfx::Rect rect = border_->GetBounds(relative_to_, adjusted_size); 173 gfx::Rect rect = border_->GetBounds(relative_rect, adjusted_size);
167 border_widget_->SetBounds(rect); 174 border_widget_->SetBounds(rect);
168 175
169 // Now calculate the inner bounds. This is a bit more convoluted than 176 // Now calculate the inner bounds. This is a bit more convoluted than
170 // it should be because BrowserBubble coordinates are in Browser coordinates 177 // it should be because BrowserBubble coordinates are in Browser coordinates
171 // while |rect| is in screen coordinates. 178 // while |rect| is in screen coordinates.
172 gfx::Insets border_insets; 179 gfx::Insets border_insets;
173 border_->GetInsets(&border_insets); 180 border_->GetInsets(&border_insets);
174 gfx::Point origin = rect.origin(); 181 gfx::Point origin = rect.origin();
175 views::View::ConvertPointToView(NULL, frame_->GetRootView(), &origin); 182 views::View::ConvertPointToView(NULL, frame_->GetRootView(), &origin);
176 183
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (closing_) 308 if (closing_)
302 return; 309 return;
303 closing_ = true; 310 closing_ = true;
304 DetachFromBrowser(); 311 DetachFromBrowser();
305 312
306 if (observer_) 313 if (observer_)
307 observer_->ExtensionPopupIsClosing(this); 314 observer_->ExtensionPopupIsClosing(this);
308 315
309 Release(); // Balanced in ctor. 316 Release(); // Balanced in ctor.
310 } 317 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698