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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 7 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) 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/extensions/extension_popup.h" 5 #include "chrome/browser/ui/views/extensions/extension_popup.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/devtools/devtools_window.h" 10 #include "chrome/browser/devtools/devtools_window.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Widget::Close posts a task, which should give the devtools window a 137 // Widget::Close posts a task, which should give the devtools window a
138 // chance to finish detaching from the inspected RenderViewHost. 138 // chance to finish detaching from the inspected RenderViewHost.
139 GetWidget()->Close(); 139 GetWidget()->Close();
140 } 140 }
141 } 141 }
142 142
143 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) { 143 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) {
144 SizeToContents(); 144 SizeToContents();
145 } 145 }
146 146
147 gfx::Size ExtensionPopup::GetPreferredSize() { 147 gfx::Size ExtensionPopup::GetPreferredSize() const {
148 // Constrain the size to popup min/max. 148 // Constrain the size to popup min/max.
149 gfx::Size sz = views::View::GetPreferredSize(); 149 gfx::Size sz = views::View::GetPreferredSize();
150 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width()))); 150 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width())));
151 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); 151 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height())));
152 return sz; 152 return sz;
153 } 153 }
154 154
155 void ExtensionPopup::OnWidgetDestroying(views::Widget* widget) { 155 void ExtensionPopup::OnWidgetDestroying(views::Widget* widget) {
156 BubbleDelegateView::OnWidgetDestroying(widget); 156 BubbleDelegateView::OnWidgetDestroying(widget);
157 #if defined(USE_AURA) 157 #if defined(USE_AURA)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 GetWidget()->Show(); 251 GetWidget()->Show();
252 252
253 // Focus on the host contents when the bubble is first shown. 253 // Focus on the host contents when the bubble is first shown.
254 host()->host_contents()->Focus(); 254 host()->host_contents()->Focus();
255 255
256 if (inspect_with_devtools_) { 256 if (inspect_with_devtools_) {
257 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), 257 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(),
258 DevToolsToggleAction::ShowConsole()); 258 DevToolsToggleAction::ShowConsole());
259 } 259 }
260 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698