| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 (*rects)[i].set_x((*rects)[i].x() + x_offset); | 129 (*rects)[i].set_x((*rects)[i].x() + x_offset); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // WidgetObserver implementation that resets the window position managed | 132 // WidgetObserver implementation that resets the window position managed |
| 133 // property on Show. | 133 // property on Show. |
| 134 // We're forced to do this here since BrowserFrameAsh resets the 'window | 134 // We're forced to do this here since BrowserFrameAsh resets the 'window |
| 135 // position managed' property during a show and we need the property set to | 135 // position managed' property during a show and we need the property set to |
| 136 // false before WorkspaceLayoutManager sees the visibility change. | 136 // false before WorkspaceLayoutManager sees the visibility change. |
| 137 class WindowPositionManagedUpdater : public views::WidgetObserver { | 137 class WindowPositionManagedUpdater : public views::WidgetObserver { |
| 138 public: | 138 public: |
| 139 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 139 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override { |
| 140 bool visible) override { | |
| 141 SetWindowPositionManaged(widget->GetNativeWindow(), false); | 140 SetWindowPositionManaged(widget->GetNativeWindow(), false); |
| 142 } | 141 } |
| 143 }; | 142 }; |
| 144 | 143 |
| 145 // EscapeTracker installs an event monitor and runs a callback when it receives | 144 // EscapeTracker installs an event monitor and runs a callback when it receives |
| 146 // the escape key. | 145 // the escape key. |
| 147 class EscapeTracker : public ui::EventHandler { | 146 class EscapeTracker : public ui::EventHandler { |
| 148 public: | 147 public: |
| 149 explicit EscapeTracker(const base::Closure& callback) | 148 explicit EscapeTracker(const base::Closure& callback) |
| 150 : escape_callback_(callback), | 149 : escape_callback_(callback), |
| 151 event_monitor_(views::EventMonitor::Create(this)) { | 150 event_monitor_(views::EventMonitor::Create(this)) { |
| 152 } | 151 } |
| 153 | 152 |
| 154 private: | 153 private: |
| 155 // ui::EventHandler: | 154 // ui::EventHandler: |
| 156 virtual void OnKeyEvent(ui::KeyEvent* key) override { | 155 void OnKeyEvent(ui::KeyEvent* key) override { |
| 157 if (key->type() == ui::ET_KEY_PRESSED && | 156 if (key->type() == ui::ET_KEY_PRESSED && |
| 158 key->key_code() == ui::VKEY_ESCAPE) { | 157 key->key_code() == ui::VKEY_ESCAPE) { |
| 159 escape_callback_.Run(); | 158 escape_callback_.Run(); |
| 160 } | 159 } |
| 161 } | 160 } |
| 162 | 161 |
| 163 base::Closure escape_callback_; | 162 base::Closure escape_callback_; |
| 164 scoped_ptr<views::EventMonitor> event_monitor_; | 163 scoped_ptr<views::EventMonitor> event_monitor_; |
| 165 | 164 |
| 166 DISALLOW_COPY_AND_ASSIGN(EscapeTracker); | 165 DISALLOW_COPY_AND_ASSIGN(EscapeTracker); |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 it != browser_list->end(); ++it) { | 1803 it != browser_list->end(); ++it) { |
| 1805 if ((*it)->tab_strip_model()->empty()) | 1804 if ((*it)->tab_strip_model()->empty()) |
| 1806 exclude.insert((*it)->window()->GetNativeWindow()); | 1805 exclude.insert((*it)->window()->GetNativeWindow()); |
| 1807 } | 1806 } |
| 1808 #endif | 1807 #endif |
| 1809 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1808 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
| 1810 screen_point, | 1809 screen_point, |
| 1811 exclude); | 1810 exclude); |
| 1812 | 1811 |
| 1813 } | 1812 } |
| OLD | NEW |