Chromium Code Reviews| Index: chrome/browser/chromeos/webui/login/browser/dom_browser_view_layout.cc |
| diff --git a/chrome/browser/chromeos/webui/login/browser/dom_browser_view_layout.cc b/chrome/browser/chromeos/webui/login/browser/dom_browser_view_layout.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f6f126951b98ec3da611ec6327fc4dbc380b2c9a |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/webui/login/browser/dom_browser_view_layout.cc |
| @@ -0,0 +1,98 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/chromeos/webui/login/browser/dom_browser_view_layout.h" |
| + |
| +#include <algorithm> |
| + |
| +#include "chrome/browser/chromeos/status/status_area_view.h" |
| +#include "chrome/browser/chromeos/view_ids.h" |
| +#include "chrome/browser/ui/views/toolbar_view.h" |
|
oshima
2011/03/17 18:49:31
do you need this?
rharrison
2011/03/21 19:49:08
Done.
|
| +#include "views/window/hit_test.h" |
| + |
| + |
|
oshima
2011/03/17 18:49:31
remove extra line
rharrison
2011/03/21 19:49:08
Done.
|
| +namespace chromeos { |
| + |
| +// DOMBrowserViewLayout public: ------------------------------------------------ |
| + |
| +DOMBrowserViewLayout::DOMBrowserViewLayout() : ::BrowserViewLayout() {} |
| + |
| +DOMBrowserViewLayout::~DOMBrowserViewLayout() {} |
| + |
| +// DOMBrowserViewLayout, ::DOMBrowserViewLayout overrides: --------------------- |
| + |
| +void DOMBrowserViewLayout::Installed(views::View* host) { |
| + status_area_ = NULL; |
| + ::BrowserViewLayout::Installed(host); |
| +} |
| + |
| +void DOMBrowserViewLayout::ViewAdded(views::View* host, |
| + views::View* view) { |
| + ::BrowserViewLayout::ViewAdded(host, view); |
| + switch (view->GetID()) { |
| + case VIEW_ID_STATUS_AREA: |
| + status_area_ = static_cast<chromeos::StatusAreaView*>(view); |
| + break; |
| + } |
| +} |
| + |
| +int DOMBrowserViewLayout::LayoutTabStrip() { |
| + status_area_->SetVisible(true); |
| + gfx::Size status_size = status_area_->GetPreferredSize(); |
| + status_area_->SetBounds(vertical_layout_rect_.width() - status_size.width(), |
| + 0, |
| + vertical_layout_rect_.width(), |
| + status_size.height()); |
| + |
| + return status_size.height(); |
| +} |
| + |
| +int DOMBrowserViewLayout::LayoutToolbar(int top) { |
| + return top; |
| +} |
|
oshima
2011/03/17 18:49:31
new line in between
rharrison
2011/03/21 19:49:08
Done.
|
| +int DOMBrowserViewLayout::LayoutBookmarkAndInfoBars(int top) { |
| + return top; |
| +} |
| + |
| +bool DOMBrowserViewLayout::IsPositionInWindowCaption(const gfx::Point& point) { |
| + return false; |
| +} |
| + |
| +int DOMBrowserViewLayout::NonClientHitTest(const gfx::Point& point) { |
| + views::View* parent = browser_view_->parent(); |
| + gfx::Point point_in_browser_view_coords(point); |
| + views::View::ConvertPointToView( |
| + parent, browser_view_, &point_in_browser_view_coords); |
| + gfx::Rect bv_bounds = browser_view_->bounds(); |
| + if (bv_bounds.Contains(point)) |
| + return HTCLIENT; |
| + // If the point is somewhere else, delegate to the default implementation. |
| + return browser_view_->views::ClientView::NonClientHitTest(point); |
| +} |
| + |
| +// DOMBrowserViewLayout private: ----------------------------------------------- |
| + |
| +bool DOMBrowserViewLayout::IsPointInViewsInTitleArea(const gfx::Point& point) |
| + const { |
| + gfx::Point point_in_status_area_coords(point); |
| + views::View::ConvertPointToView(browser_view_, status_area_, |
| + &point_in_status_area_coords); |
| + return status_area_->HitTest(point_in_status_area_coords); |
| +} |
| + |
| +int DOMBrowserViewLayout::LayoutTitlebarComponents(const gfx::Rect& bounds) { |
| + status_area_->SetVisible(true); |
| + gfx::Size status_size = status_area_->GetPreferredSize(); |
| + status_area_->SetBounds(bounds.right() - status_size.width(), |
| + bounds.y(), |
| + status_size.width(), |
| + status_size.height()); |
| + return status_size.height(); |
| +} |
| + |
| +DOMBrowserView* DOMBrowserViewLayout::GetDOMBrowserView() { |
| + return static_cast<DOMBrowserView*>(browser_view_); |
| +} |
| + |
| +} // namespace chromeos |