// The visible height of the shadow above the tabs. Clicks in this area are
// treated as clicks to the frame, rather than clicks to the tab.
const int kTabShadowSize = 2;
-// The number of pixels the metro switcher is offset from the right edge.
-const int kWindowSwitcherOffsetX = 7;
// The number of pixels the constrained window should overlap the bottom
// of the omnibox.
const int kConstrainedWindowOverlap = 3;
: browser_view_layout_(browser_view_layout) {
}
- virtual ~WebContentsModalDialogHostViews() {
+ ~WebContentsModalDialogHostViews() override {
FOR_EACH_OBSERVER(ModalDialogHostObserver,
observer_list_,
OnHostDestroying());
OnPositionRequiresUpdate());
}
- virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE {
+ gfx::Point GetDialogPosition(const gfx::Size& size) override {
views::View* view = browser_view_layout_->contents_container_;
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
const int middle_x = content_area.x() + content_area.width() / 2;
return gfx::Point(middle_x - size.width() / 2, top);
}
- virtual gfx::Size GetMaximumDialogSize() OVERRIDE {
+ gfx::Size GetMaximumDialogSize() override {
views::View* view = browser_view_layout_->contents_container_;
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
const int top = browser_view_layout_->web_contents_modal_dialog_top_y_;
}
private:
- virtual gfx::NativeView GetHostView() const OVERRIDE {
+ gfx::NativeView GetHostView() const override {
gfx::NativeWindow window =
browser_view_layout_->browser()->window()->GetNativeWindow();
return views::Widget::GetWidgetForNativeWindow(window)->GetNativeView();
}
// Add/remove observer.
- virtual void AddObserver(ModalDialogHostObserver* observer) OVERRIDE {
+ void AddObserver(ModalDialogHostObserver* observer) override {
observer_list_.AddObserver(observer);
}
- virtual void RemoveObserver(ModalDialogHostObserver* observer) OVERRIDE {
+ void RemoveObserver(ModalDialogHostObserver* observer) override {
observer_list_.RemoveObserver(observer);
}
if (bv_bounds.Contains(point))
return HTCLIENT;
- // If the point is within the bounds of the window switcher button, the point
- // is considered to be within the client area.
- views::View* window_switcher_button = delegate_->GetWindowSwitcherButton();
- if (window_switcher_button && window_switcher_button->visible()) {
- gfx::Point window_switcher_point(point_in_browser_view_coords);
- views::View::ConvertPointToTarget(browser_view_, window_switcher_button,
- &window_switcher_point);
- if (window_switcher_button->HitTestPoint(window_switcher_point))
- return HTCLIENT;
- }
-
- // If the point's y coordinate is above the top of the toolbar, but neither
- // over the tabstrip nor over the window switcher button (per previous
- // checking in this function), then we consider it in the window caption
- // (e.g. the area to the right of the tabstrip underneath the window
- // controls). However, note that we DO NOT return HTCAPTION here, because
- // when the window is maximized the window controls will fall into this
- // space (since the BrowserView is sized to entire size of the window at that
- // point), and the HTCAPTION value will cause the window controls not to work.
- // So we return HTNOWHERE so that the caller will hit-test the window controls
- // before finally falling back to HTCAPTION.
+ // If the point's y coordinate is above the top of the toolbar, but not
+ // over the tabstrip (per previous checking in this function), then we
+ // consider it in the window caption (e.g. the area to the right of the
+ // tabstrip underneath the window controls). However, note that we DO NOT
+ // return HTCAPTION here, because when the window is maximized the window
+ // controls will fall into this space (since the BrowserView is sized to
+ // entire size of the window at that point), and the HTCAPTION value will
+ // cause the window controls not to work. So we return HTNOWHERE so that the
+ // caller will hit-test the window controls before finally falling back to
+ // HTCAPTION.
bv_bounds = browser_view_->bounds();
bv_bounds.set_height(toolbar_->y());
if (bv_bounds.Contains(point))
// Return the preferred size which is the size required to give each
// children their respective preferred size.
-gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) {
+gfx::Size BrowserViewLayout::GetPreferredSize(const views::View* host) const {
return gfx::Size();
}
tab_strip_->SetVisible(true);
tab_strip_->SetBoundsRect(tabstrip_bounds);
- int bottom = tabstrip_bounds.bottom();
-
- // The metro window switcher sits at the far right edge of the tabstrip
- // a |kWindowSwitcherOffsetX| pixels from the right edge.
- // Only visible if there is more than one type of window to switch between.
- // TODO(mad): update this code when more window types than just incognito
- // and regular are available.
- views::View* switcher_button = delegate_->GetWindowSwitcherButton();
- if (switcher_button) {
- if (browser()->profile()->HasOffTheRecordProfile() &&
- chrome::FindBrowserWithProfile(
- browser()->profile()->GetOriginalProfile(),
- browser()->host_desktop_type()) != NULL) {
- switcher_button->SetVisible(true);
- int width = browser_view_->width();
- gfx::Size ps = switcher_button->GetPreferredSize();
- if (width > ps.width()) {
- switcher_button->SetBounds(width - ps.width() - kWindowSwitcherOffsetX,
- 0,
- ps.width(),
- ps.height());
- }
- } else {
- // We hide the button if the incognito profile is not alive.
- // Note that Layout() is not called to all browser windows automatically
- // when a profile goes away but we rely in the metro_driver.dll to call
- // ::SetWindowPos( , .. SWP_SHOWWINDOW) which causes this function to
- // be called again. This works both in showing or hidding the button.
- switcher_button->SetVisible(false);
- }
- }
- return bottom;
+ return tabstrip_bounds.bottom();
}
int BrowserViewLayout::LayoutToolbar(int top) {