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

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: More compile fix for 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 "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/devtools/devtools_window.h" 9 #include "chrome/browser/devtools/devtools_window.h"
10 #include "chrome/browser/extensions/extension_view_host.h" 10 #include "chrome/browser/extensions/extension_view_host.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Widget::Close posts a task, which should give the devtools window a 111 // Widget::Close posts a task, which should give the devtools window a
112 // chance to finish detaching from the inspected RenderViewHost. 112 // chance to finish detaching from the inspected RenderViewHost.
113 GetWidget()->Close(); 113 GetWidget()->Close();
114 } 114 }
115 } 115 }
116 116
117 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) { 117 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) {
118 SizeToContents(); 118 SizeToContents();
119 } 119 }
120 120
121 gfx::Size ExtensionPopup::GetPreferredSize() { 121 gfx::Size ExtensionPopup::GetPreferredSize() const {
122 // Constrain the size to popup min/max. 122 // Constrain the size to popup min/max.
123 gfx::Size sz = views::View::GetPreferredSize(); 123 gfx::Size sz = views::View::GetPreferredSize();
124 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width()))); 124 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width())));
125 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); 125 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height())));
126 return sz; 126 return sz;
127 } 127 }
128 128
129 void ExtensionPopup::ViewHierarchyChanged( 129 void ExtensionPopup::ViewHierarchyChanged(
130 const ViewHierarchyChangedDetails& details) { 130 const ViewHierarchyChangedDetails& details) {
131 // TODO(msw): Find any remaining crashes related to http://crbug.com/327776 131 // TODO(msw): Find any remaining crashes related to http://crbug.com/327776
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 GetWidget()->Show(); 215 GetWidget()->Show();
216 216
217 // Focus on the host contents when the bubble is first shown. 217 // Focus on the host contents when the bubble is first shown.
218 host()->host_contents()->Focus(); 218 host()->host_contents()->Focus();
219 219
220 if (inspect_with_devtools_) { 220 if (inspect_with_devtools_) {
221 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), 221 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(),
222 DevToolsToggleAction::ShowConsole()); 222 DevToolsToggleAction::ShowConsole());
223 } 223 }
224 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698