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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout.cc

Issue 22903022: Limit constrained windows to the size of the parent view. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added GetMaximumDialogSize Created 7 years, 4 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame/browser_view_layout.h" 5 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Center horizontally over the content area, with the top overlapping the 92 // Center horizontally over the content area, with the top overlapping the
93 // browser chrome. 93 // browser chrome.
94 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE { 94 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE {
95 int top_y = browser_view_layout_->web_contents_modal_dialog_top_y_; 95 int top_y = browser_view_layout_->web_contents_modal_dialog_top_y_;
96 gfx::Rect content_area = 96 gfx::Rect content_area =
97 browser_view_layout_->browser_view_->GetClientAreaBounds(); 97 browser_view_layout_->browser_view_->GetClientAreaBounds();
98 int middle_x = content_area.x() + content_area.width() / 2; 98 int middle_x = content_area.x() + content_area.width() / 2;
99 return gfx::Point(middle_x - size.width() / 2, top_y); 99 return gfx::Point(middle_x - size.width() / 2, top_y);
100 } 100 }
101 101
102 virtual gfx::Size GetMaximumDialogSize() OVERRIDE {
103 return browser_view_layout_->browser_view_->GetClientAreaBounds().size();
104 }
105
102 // Add/remove observer. 106 // Add/remove observer.
103 virtual void AddObserver( 107 virtual void AddObserver(
104 WebContentsModalDialogHostObserver* observer) OVERRIDE { 108 WebContentsModalDialogHostObserver* observer) OVERRIDE {
105 observer_list_.AddObserver(observer); 109 observer_list_.AddObserver(observer);
106 } 110 }
107 virtual void RemoveObserver( 111 virtual void RemoveObserver(
108 WebContentsModalDialogHostObserver* observer) OVERRIDE { 112 WebContentsModalDialogHostObserver* observer) OVERRIDE {
109 observer_list_.RemoveObserver(observer); 113 observer_list_.RemoveObserver(observer);
110 } 114 }
111 115
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return bottom; 566 return bottom;
563 } 567 }
564 568
565 bool BrowserViewLayout::InfobarVisible() const { 569 bool BrowserViewLayout::InfobarVisible() const {
566 // Cast to a views::View to access GetPreferredSize(). 570 // Cast to a views::View to access GetPreferredSize().
567 views::View* infobar_container = infobar_container_; 571 views::View* infobar_container = infobar_container_;
568 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. 572 // NOTE: Can't check if the size IsEmpty() since it's always 0-width.
569 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && 573 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) &&
570 (infobar_container->GetPreferredSize().height() != 0); 574 (infobar_container->GetPreferredSize().height() != 0);
571 } 575 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698