• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/ui/views/frame/browser_frame.h"
6 
7 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
8 #include "chrome/browser/ui/views/frame/browser_root_view.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "chrome/browser/ui/views/frame/native_browser_frame.h"
11 #include "views/widget/native_widget.h"
12 #include "views/widget/widget.h"
13 #include "views/window/native_window.h"
14 #include "views/window/window.h"
15 
16 ////////////////////////////////////////////////////////////////////////////////
17 // BrowserFrame, public:
18 
~BrowserFrame()19 BrowserFrame::~BrowserFrame() {
20 }
21 
GetWindow()22 views::Window* BrowserFrame::GetWindow() {
23   return native_browser_frame_->AsNativeWindow()->GetWindow();
24 }
25 
GetMinimizeButtonOffset() const26 int BrowserFrame::GetMinimizeButtonOffset() const {
27   return native_browser_frame_->GetMinimizeButtonOffset();
28 }
29 
GetBoundsForTabStrip(views::View * tabstrip) const30 gfx::Rect BrowserFrame::GetBoundsForTabStrip(views::View* tabstrip) const {
31   return browser_frame_view_->GetBoundsForTabStrip(tabstrip);
32 }
33 
GetHorizontalTabStripVerticalOffset(bool restored) const34 int BrowserFrame::GetHorizontalTabStripVerticalOffset(bool restored) const {
35   return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored);
36 }
37 
UpdateThrobber(bool running)38 void BrowserFrame::UpdateThrobber(bool running) {
39   browser_frame_view_->UpdateThrobber(running);
40 }
41 
GetThemeProviderForFrame() const42 ui::ThemeProvider* BrowserFrame::GetThemeProviderForFrame() const {
43   return native_browser_frame_->GetThemeProviderForFrame();
44 }
45 
AlwaysUseNativeFrame() const46 bool BrowserFrame::AlwaysUseNativeFrame() const {
47   return native_browser_frame_->AlwaysUseNativeFrame();
48 }
49 
GetFrameView() const50 views::View* BrowserFrame::GetFrameView() const {
51   return browser_frame_view_;
52 }
53 
TabStripDisplayModeChanged()54 void BrowserFrame::TabStripDisplayModeChanged() {
55   native_browser_frame_->TabStripDisplayModeChanged();
56 }
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 // BrowserFrame, NativeBrowserFrameDelegate implementation:
60 
DelegateCreateRootView()61 views::RootView* BrowserFrame::DelegateCreateRootView() {
62   root_view_ = new BrowserRootView(
63       browser_view_,
64       native_browser_frame_->AsNativeWindow()->AsNativeWidget()->GetWidget());
65   return root_view_;
66 }
67 
DelegateCreateFrameViewForWindow()68 views::NonClientFrameView* BrowserFrame::DelegateCreateFrameViewForWindow() {
69   browser_frame_view_ =
70       native_browser_frame_->CreateBrowserNonClientFrameView();
71   return browser_frame_view_;
72 }
73 
74 
75 ////////////////////////////////////////////////////////////////////////////////
76 // BrowserFrame, protected:
77 
BrowserFrame(BrowserView * browser_view)78 BrowserFrame::BrowserFrame(BrowserView* browser_view)
79     : native_browser_frame_(NULL),
80       root_view_(NULL),
81       browser_frame_view_(NULL),
82       browser_view_(browser_view) {
83 }
84