| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/frame/browser_frame_aura.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_aura.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/ui/views/frame/browser_view.h" | 8 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 9 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h" | 9 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h" |
| 10 #include "grit/chromium_strings.h" | 10 #include "grit/chromium_strings.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/models/simple_menu_model.h" | 17 #include "ui/base/models/simple_menu_model.h" |
| 18 #include "ui/gfx/font.h" | 18 #include "ui/gfx/font.h" |
| 19 #include "ui/views/controls/menu/menu_model_adapter.h" | 19 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 20 #include "ui/views/controls/menu/menu_runner.h" | 20 #include "ui/views/controls/menu/menu_runner.h" |
| 21 #include "ui/views/view.h" | 21 #include "ui/views/view.h" |
| 22 | 22 |
| 23 #if defined(USE_ASH) | 23 #if defined(USE_ASH) |
| 24 #include "ash/wm/property_util.h" | 24 #include "ash/wm/property_util.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 using aura::Window; |
| 28 |
| 27 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
| 28 // BrowserFrameAura::WindowPropertyWatcher | 30 // BrowserFrameAura::WindowPropertyWatcher |
| 29 | 31 |
| 30 class BrowserFrameAura::WindowPropertyWatcher : public aura::WindowObserver { | 32 class BrowserFrameAura::WindowPropertyWatcher : public aura::WindowObserver { |
| 31 public: | 33 public: |
| 32 explicit WindowPropertyWatcher(BrowserFrameAura* browser_frame_aura, | 34 explicit WindowPropertyWatcher(BrowserFrameAura* browser_frame_aura, |
| 33 BrowserFrame* browser_frame) | 35 BrowserFrame* browser_frame) |
| 34 : browser_frame_aura_(browser_frame_aura), | 36 : browser_frame_aura_(browser_frame_aura), |
| 35 browser_frame_(browser_frame) {} | 37 browser_frame_(browser_frame) {} |
| 36 | 38 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 browser_view_(browser_view), | 78 browser_view_(browser_view), |
| 77 window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) { | 79 window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) { |
| 78 GetNativeWindow()->SetName("BrowserFrameAura"); | 80 GetNativeWindow()->SetName("BrowserFrameAura"); |
| 79 GetNativeWindow()->AddObserver(window_property_watcher_.get()); | 81 GetNativeWindow()->AddObserver(window_property_watcher_.get()); |
| 80 #if defined(USE_ASH) | 82 #if defined(USE_ASH) |
| 81 if (browser_view->browser()->type() != Browser::TYPE_POPUP) { | 83 if (browser_view->browser()->type() != Browser::TYPE_POPUP) { |
| 82 ash::SetPersistsAcrossAllWorkspaces( | 84 ash::SetPersistsAcrossAllWorkspaces( |
| 83 GetNativeWindow(), | 85 GetNativeWindow(), |
| 84 ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_NO); | 86 ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_NO); |
| 85 } | 87 } |
| 88 // HACK: Don't animate app windows. They delete and rebuild their frame on |
| 89 // maximize, which breaks the layer animations. We probably shouldn't rebuild |
| 90 // the frame view on this transition. |
| 91 // TODO(jamescook): Fix app window animation. http://crbug.com/131293 |
| 92 if (browser_view->browser()->is_app()) { |
| 93 Window* window = GetNativeWindow(); |
| 94 window->SetProperty(aura::client::kAnimationsDisabledKey, true); |
| 95 } |
| 86 #endif | 96 #endif |
| 87 } | 97 } |
| 88 | 98 |
| 89 BrowserFrameAura::~BrowserFrameAura() { | 99 BrowserFrameAura::~BrowserFrameAura() { |
| 90 } | 100 } |
| 91 | 101 |
| 92 /////////////////////////////////////////////////////////////////////////////// | 102 /////////////////////////////////////////////////////////////////////////////// |
| 93 // BrowserFrameAura, views::ContextMenuController overrides: | 103 // BrowserFrameAura, views::ContextMenuController overrides: |
| 94 void BrowserFrameAura::ShowContextMenuForView(views::View* source, | 104 void BrowserFrameAura::ShowContextMenuForView(views::View* source, |
| 95 const gfx::Point& p) { | 105 const gfx::Point& p) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 177 |
| 168 //////////////////////////////////////////////////////////////////////////////// | 178 //////////////////////////////////////////////////////////////////////////////// |
| 169 // NativeBrowserFrame, public: | 179 // NativeBrowserFrame, public: |
| 170 | 180 |
| 171 // static | 181 // static |
| 172 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( | 182 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( |
| 173 BrowserFrame* browser_frame, | 183 BrowserFrame* browser_frame, |
| 174 BrowserView* browser_view) { | 184 BrowserView* browser_view) { |
| 175 return new BrowserFrameAura(browser_frame, browser_view); | 185 return new BrowserFrameAura(browser_frame, browser_view); |
| 176 } | 186 } |
| OLD | NEW |