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/tabs/tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 // WidgetObserver implementation that resets the window position managed | 117 // WidgetObserver implementation that resets the window position managed |
118 // property on Show. | 118 // property on Show. |
119 // We're forced to do this here since BrowserFrameAsh resets the 'window | 119 // We're forced to do this here since BrowserFrameAsh resets the 'window |
120 // position managed' property during a show and we need the property set to | 120 // position managed' property during a show and we need the property set to |
121 // false before WorkspaceLayoutManager sees the visibility change. | 121 // false before WorkspaceLayoutManager sees the visibility change. |
122 class WindowPositionManagedUpdater : public views::WidgetObserver { | 122 class WindowPositionManagedUpdater : public views::WidgetObserver { |
123 public: | 123 public: |
124 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 124 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
125 bool visible) OVERRIDE { | 125 bool visible) override { |
126 SetWindowPositionManaged(widget->GetNativeView(), false); | 126 SetWindowPositionManaged(widget->GetNativeView(), false); |
127 } | 127 } |
128 }; | 128 }; |
129 | 129 |
130 // EscapeTracker installs itself as a pre-target handler on aura::Env and runs a | 130 // EscapeTracker installs itself as a pre-target handler on aura::Env and runs a |
131 // callback when it receives the escape key. | 131 // callback when it receives the escape key. |
132 class EscapeTracker : public ui::EventHandler { | 132 class EscapeTracker : public ui::EventHandler { |
133 public: | 133 public: |
134 explicit EscapeTracker(const base::Closure& callback) | 134 explicit EscapeTracker(const base::Closure& callback) |
135 : escape_callback_(callback) { | 135 : escape_callback_(callback) { |
136 aura::Env::GetInstance()->AddPreTargetHandler(this); | 136 aura::Env::GetInstance()->AddPreTargetHandler(this); |
137 } | 137 } |
138 | 138 |
139 virtual ~EscapeTracker() { | 139 virtual ~EscapeTracker() { |
140 aura::Env::GetInstance()->RemovePreTargetHandler(this); | 140 aura::Env::GetInstance()->RemovePreTargetHandler(this); |
141 } | 141 } |
142 | 142 |
143 private: | 143 private: |
144 // ui::EventHandler: | 144 // ui::EventHandler: |
145 virtual void OnKeyEvent(ui::KeyEvent* key) OVERRIDE { | 145 virtual void OnKeyEvent(ui::KeyEvent* key) override { |
146 if (key->type() == ui::ET_KEY_PRESSED && | 146 if (key->type() == ui::ET_KEY_PRESSED && |
147 key->key_code() == ui::VKEY_ESCAPE) { | 147 key->key_code() == ui::VKEY_ESCAPE) { |
148 escape_callback_.Run(); | 148 escape_callback_.Run(); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 base::Closure escape_callback_; | 152 base::Closure escape_callback_; |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(EscapeTracker); | 154 DISALLOW_COPY_AND_ASSIGN(EscapeTracker); |
155 }; | 155 }; |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 it != browser_list->end(); ++it) { | 1786 it != browser_list->end(); ++it) { |
1787 if ((*it)->tab_strip_model()->empty()) | 1787 if ((*it)->tab_strip_model()->empty()) |
1788 exclude.insert((*it)->window()->GetNativeWindow()); | 1788 exclude.insert((*it)->window()->GetNativeWindow()); |
1789 } | 1789 } |
1790 #endif | 1790 #endif |
1791 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1791 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
1792 screen_point, | 1792 screen_point, |
1793 exclude); | 1793 exclude); |
1794 | 1794 |
1795 } | 1795 } |
OLD | NEW |