Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 OnHostDestroying()); | 72 OnHostDestroying()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void NotifyPositionRequiresUpdate() { | 75 void NotifyPositionRequiresUpdate() { |
| 76 FOR_EACH_OBSERVER(ModalDialogHostObserver, | 76 FOR_EACH_OBSERVER(ModalDialogHostObserver, |
| 77 observer_list_, | 77 observer_list_, |
| 78 OnPositionRequiresUpdate()); | 78 OnPositionRequiresUpdate()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE { | 81 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE { |
| 82 views::View* view = browser_view_layout_->delegate_->GetContentsWebView(); | 82 views::View* view = browser_view_layout_->contents_container_; |
|
dgozman
2014/02/17 16:03:03
You want devtools_web_view_ from BrowserView here.
lushnikov
2014/02/18 18:17:06
Left as-is due to offline discussion.
| |
| 83 gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); | 83 gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); |
| 84 const int middle_x = content_area.x() + content_area.width() / 2; | 84 const int middle_x = content_area.x() + content_area.width() / 2; |
| 85 const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; | 85 const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; |
| 86 return gfx::Point(middle_x - size.width() / 2, top); | 86 return gfx::Point(middle_x - size.width() / 2, top); |
| 87 } | 87 } |
| 88 | 88 |
| 89 virtual gfx::Size GetMaximumDialogSize() OVERRIDE { | 89 virtual gfx::Size GetMaximumDialogSize() OVERRIDE { |
| 90 views::View* view = browser_view_layout_->delegate_->GetContentsWebView(); | 90 views::View* view = browser_view_layout_->contents_container_; |
| 91 gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); | 91 gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); |
| 92 const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; | 92 const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; |
| 93 return gfx::Size(content_area.width(), content_area.bottom() - top); | 93 return gfx::Size(content_area.width(), content_area.bottom() - top); |
| 94 } | 94 } |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 virtual gfx::NativeView GetHostView() const OVERRIDE { | 97 virtual gfx::NativeView GetHostView() const OVERRIDE { |
| 98 gfx::NativeWindow window = | 98 gfx::NativeWindow window = |
| 99 browser_view_layout_->browser()->window()->GetNativeWindow(); | 99 browser_view_layout_->browser()->window()->GetNativeWindow(); |
| 100 return views::Widget::GetWidgetForNativeWindow(window)->GetNativeView(); | 100 return views::Widget::GetWidgetForNativeWindow(window)->GetNativeView(); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 return bottom; | 584 return bottom; |
| 585 } | 585 } |
| 586 | 586 |
| 587 bool BrowserViewLayout::InfobarVisible() const { | 587 bool BrowserViewLayout::InfobarVisible() const { |
| 588 // Cast to a views::View to access GetPreferredSize(). | 588 // Cast to a views::View to access GetPreferredSize(). |
| 589 views::View* infobar_container = infobar_container_; | 589 views::View* infobar_container = infobar_container_; |
| 590 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. | 590 // NOTE: Can't check if the size IsEmpty() since it's always 0-width. |
| 591 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && | 591 return browser_->SupportsWindowFeature(Browser::FEATURE_INFOBAR) && |
| 592 (infobar_container->GetPreferredSize().height() != 0); | 592 (infobar_container->GetPreferredSize().height() != 0); |
| 593 } | 593 } |
| OLD | NEW |