 Chromium Code Reviews
 Chromium Code Reviews Issue 6692001:
  Add in DOMBrowserView and Frame related classes  (Closed) 
  Base URL: http://git.chromium.org/git/chromium.git@trunk
    
  
    Issue 6692001:
  Add in DOMBrowserView and Frame related classes  (Closed) 
  Base URL: http://git.chromium.org/git/chromium.git@trunk| 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..90bcbdcf319d7653ec0958b0f54d0d917ee9d3e5 | 
| --- /dev/null | 
| +++ b/chrome/browser/chromeos/webui/login/browser/dom_browser_view_layout.cc | 
| @@ -0,0 +1,129 @@ | 
| +// 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" | 
| +#include "views/window/hit_test.h" | 
| + | 
| +namespace { | 
| + | 
| +// Amount to offset the toolbar by when vertical tabs are enabled. | 
| 
Nikita (slow)
2011/03/16 21:33:45
Do you need this considering that DOMBrowserView l
 
rharrison
2011/03/17 17:00:50
No, forgot to clean it up.
 | 
| +const int kVerticalTabStripToolbarOffset = 2; | 
| + | 
| +} // namespace | 
| + | 
| + | 
| +namespace chromeos { | 
| + | 
| +// LayoutManager for DOMBrowserView, which lays out the StatusAreaView in the | 
| 
Nikita (slow)
2011/03/16 21:33:45
Please move comment to header.
 
rharrison
2011/03/17 17:00:50
Done.
 | 
| +// top corner and ommits the other elements that have been removed from the | 
| +// view. There is a bar accross the top of the screen which is clearly divided | 
| +// from the rest of the screen. The far left side will eventually have Add User | 
| +// button in it. | 
| +// | 
| +// |-------------------------------------------------------| | 
| +// |[ Future Add User button] [Status Area View]| <-- DOMBrowserView | 
| +// |-------------------------------------------------------| | 
| +// | | | 
| +// | | | 
| +// | DOM screen | | 
| +// | | | 
| +// | | | 
| +// | | | 
| +// |-------------------------------------------------------| | 
| +// | | | 
| +// | | | 
| +// | Touch Keyboard | | 
| +// | | | 
| +// | | | 
| +// |-------------------------------------------------------| | 
| + | 
| +// DOMBrowserViewLayout public: ------------------------------------------------ | 
| + | 
| +// 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; | 
| 
Nikita (slow)
2011/03/16 21:33:45
nit: fix indent.
 
rharrison
2011/03/17 17:00:50
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. | 
| 
Nikita (slow)
2011/03/16 21:33:45
nit: fix indent.
 
rharrison
2011/03/17 17:00:50
Done.
 | 
| + return browser_view_->views::ClientView::NonClientHitTest(point); | 
| +} | 
| + | 
| +// DOMBrowserViewLayout private: ----------------------------------------------- | 
| + | 
| +// Tests if the point is on one of views that are within the | 
| 
Nikita (slow)
2011/03/16 21:33:45
Move comment to header.
 
rharrison
2011/03/17 17:00:50
Done.
 | 
| +// considered title bar area of client view. | 
| +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); | 
| + if (status_area_->HitTest(point_in_status_area_coords)) | 
| + return true; | 
| 
oshima
2011/03/16 21:10:25
just
return status_area_->HitTest(point_in_status
 
rharrison
2011/03/17 17:00:50
Done.
 | 
| + | 
| + return false; | 
| +} | 
| + | 
| +// Lays out tabstrip and status area in the title bar area (given by | 
| 
Nikita (slow)
2011/03/16 21:33:45
Move comment to header.
 
rharrison
2011/03/17 17:00:50
Done.
 | 
| +// |bounds|). | 
| +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(), | 
| 
Nikita (slow)
2011/03/16 21:33:45
nit: 1 param per line please.
 
rharrison
2011/03/17 17:00:50
Done.
 | 
| + status_size.width(), status_size.height()); | 
| + return status_size.height(); | 
| +} | 
| + | 
| +DOMBrowserView* DOMBrowserViewLayout::GetDOMBrowserView() { | 
| + return static_cast<DOMBrowserView*>(browser_view_); | 
| +} | 
| + | 
| +} // namespace chromeos |