| 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" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 /////////////////////////////////////////////////////////////////////////////// | 131 /////////////////////////////////////////////////////////////////////////////// |
| 132 // BrowserFrameAura, views::NativeWidgetAura overrides: | 132 // BrowserFrameAura, views::NativeWidgetAura overrides: |
| 133 | 133 |
| 134 void BrowserFrameAura::OnWindowDestroying() { | 134 void BrowserFrameAura::OnWindowDestroying() { |
| 135 // Window is destroyed before our destructor is called, so clean up our | 135 // Window is destroyed before our destructor is called, so clean up our |
| 136 // observer here. | 136 // observer here. |
| 137 GetNativeWindow()->RemoveObserver(window_property_watcher_.get()); | 137 GetNativeWindow()->RemoveObserver(window_property_watcher_.get()); |
| 138 views::NativeWidgetAura::OnWindowDestroying(); | 138 views::NativeWidgetAura::OnWindowDestroying(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void BrowserFrameAura::OnWindowTargetVisibilityChanged(bool visible) { |
| 142 // On Aura when the BrowserView is shown it tries to restore focus, but can |
| 143 // be blocked when this parent BrowserFrameAura isn't visible. Therefore we |
| 144 // RestoreFocus() when we become visible, which results in the web contents |
| 145 // being asked to focus, which places focus either in the web contents or in |
| 146 // the location bar as appropriate. |
| 147 if (visible) |
| 148 browser_view_->RestoreFocus(); |
| 149 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); |
| 150 } |
| 151 |
| 141 //////////////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////////////// |
| 142 // BrowserFrameAura, NativeBrowserFrame implementation: | 153 // BrowserFrameAura, NativeBrowserFrame implementation: |
| 143 | 154 |
| 144 views::NativeWidget* BrowserFrameAura::AsNativeWidget() { | 155 views::NativeWidget* BrowserFrameAura::AsNativeWidget() { |
| 145 return this; | 156 return this; |
| 146 } | 157 } |
| 147 | 158 |
| 148 const views::NativeWidget* BrowserFrameAura::AsNativeWidget() const { | 159 const views::NativeWidget* BrowserFrameAura::AsNativeWidget() const { |
| 149 return this; | 160 return this; |
| 150 } | 161 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 BrowserFrame* browser_frame, | 191 BrowserFrame* browser_frame, |
| 181 BrowserView* browser_view) { | 192 BrowserView* browser_view) { |
| 182 return new BrowserFrameAura(browser_frame, browser_view); | 193 return new BrowserFrameAura(browser_frame, browser_view); |
| 183 } | 194 } |
| 184 | 195 |
| 185 /////////////////////////////////////////////////////////////////////////////// | 196 /////////////////////////////////////////////////////////////////////////////// |
| 186 // BrowserFrameAura, private: | 197 // BrowserFrameAura, private: |
| 187 | 198 |
| 188 BrowserFrameAura::~BrowserFrameAura() { | 199 BrowserFrameAura::~BrowserFrameAura() { |
| 189 } | 200 } |
| OLD | NEW |