Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / desktop_browser_frame_aura.cc
blob8b5bb71a8b588014f49fd32c8a3a52fe4afc7d19
1 // Copyright (c) 2012 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.
5 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h"
7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/ui/views/frame/browser_desktop_root_window_host.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "chrome/browser/ui/views/frame/desktop_user_action_handler_aura.h"
11 #include "grit/chromium_strings.h"
12 #include "grit/generated_resources.h"
13 #include "ui/aura/client/aura_constants.h"
14 #include "ui/aura/root_window.h"
15 #include "ui/aura/window.h"
16 #include "ui/aura/window_observer.h"
17 #include "ui/base/hit_test.h"
18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/models/simple_menu_model.h"
20 #include "ui/gfx/font.h"
21 #include "ui/views/corewm/visibility_controller.h"
22 #include "ui/views/view.h"
24 using aura::Window;
26 ///////////////////////////////////////////////////////////////////////////////
27 // DesktopBrowserFrameAura, public:
29 DesktopBrowserFrameAura::DesktopBrowserFrameAura(
30 BrowserFrame* browser_frame,
31 BrowserView* browser_view)
32 : views::DesktopNativeWidgetAura(browser_frame),
33 browser_view_(browser_view),
34 browser_frame_(browser_frame),
35 browser_desktop_root_window_host_(NULL) {
36 GetNativeWindow()->SetName("BrowserFrameAura");
39 ///////////////////////////////////////////////////////////////////////////////
40 // DesktopBrowserFrameAura, protected:
42 DesktopBrowserFrameAura::~DesktopBrowserFrameAura() {
45 ///////////////////////////////////////////////////////////////////////////////
46 // DesktopBrowserFrameAura, views::DesktopNativeWidgetAura overrides:
48 void DesktopBrowserFrameAura::OnHostClosed() {
49 aura::client::SetVisibilityClient(GetNativeView()->GetRootWindow(), NULL);
50 DesktopNativeWidgetAura::OnHostClosed();
53 void DesktopBrowserFrameAura::InitNativeWidget(
54 const views::Widget::InitParams& params) {
55 browser_desktop_root_window_host_ =
56 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost(
57 browser_frame_,
58 this,
59 browser_view_,
60 browser_frame_);
61 views::Widget::InitParams modified_params = params;
62 modified_params.desktop_root_window_host =
63 browser_desktop_root_window_host_->AsDesktopWindowTreeHost();
64 DesktopNativeWidgetAura::InitNativeWidget(modified_params);
66 user_action_client_.reset(
67 new DesktopUserActionHandlerAura(browser_view_->browser()));
68 aura::client::SetUserActionClient(GetNativeView()->GetRootWindow(),
69 user_action_client_.get());
71 visibility_controller_.reset(new views::corewm::VisibilityController);
72 aura::client::SetVisibilityClient(GetNativeView()->GetRootWindow(),
73 visibility_controller_.get());
74 views::corewm::SetChildWindowVisibilityChangesAnimated(
75 GetNativeView()->GetRootWindow());
78 ////////////////////////////////////////////////////////////////////////////////
79 // DesktopBrowserFrameAura, NativeBrowserFrame implementation:
81 views::NativeWidget* DesktopBrowserFrameAura::AsNativeWidget() {
82 return this;
85 const views::NativeWidget* DesktopBrowserFrameAura::AsNativeWidget() const {
86 return this;
89 bool DesktopBrowserFrameAura::UsesNativeSystemMenu() const {
90 return browser_desktop_root_window_host_->UsesNativeSystemMenu();
93 int DesktopBrowserFrameAura::GetMinimizeButtonOffset() const {
94 return browser_desktop_root_window_host_->GetMinimizeButtonOffset();