OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/panels/panel_mouse_watcher.h" | 5 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
6 | 6 |
7 #include "chrome/browser/ui/panels/panel_manager.h" | 7 #include "chrome/browser/ui/panels/panel_manager.h" |
8 | 8 |
9 PanelMouseWatcher::PanelMouseWatcher() | 9 PanelMouseWatcher::PanelMouseWatcher() |
10 : bring_up_titlebar_(false), is_testing_mode_enabled_(false) { | 10 : bring_up_titlebar_(false), is_testing_mode_enabled_(false) { |
11 } | 11 } |
12 | 12 |
13 PanelMouseWatcher::~PanelMouseWatcher() { | 13 PanelMouseWatcher::~PanelMouseWatcher() { |
| 14 DCHECK(subscribers_.size() == 0); |
14 } | 15 } |
15 | 16 |
16 void PanelMouseWatcher::AddSubscriber(NativePanel* native_panel) { | 17 void PanelMouseWatcher::AddSubscriber(NativePanel* native_panel) { |
17 if (is_testing_mode_enabled_) | 18 if (is_testing_mode_enabled_) |
18 return; | 19 return; |
19 | 20 |
20 if (subscribers_.count(native_panel) == 0) { | 21 if (subscribers_.count(native_panel) == 0) { |
21 subscribers_.insert(native_panel); | 22 subscribers_.insert(native_panel); |
22 DCHECK_LE(subscribers_.size(), | 23 DCHECK_LE(subscribers_.size(), |
23 static_cast<size_t>(PanelManager::GetInstance()->num_panels())); | 24 static_cast<size_t>(PanelManager::GetInstance()->num_panels())); |
(...skipping 28 matching lines...) Expand all Loading... |
52 PanelManager* panel_manager = PanelManager::GetInstance(); | 53 PanelManager* panel_manager = PanelManager::GetInstance(); |
53 | 54 |
54 bool bring_up_titlebar = | 55 bool bring_up_titlebar = |
55 panel_manager->ShouldBringUpTitlebars( | 56 panel_manager->ShouldBringUpTitlebars( |
56 mouse_position.x(), mouse_position.y()); | 57 mouse_position.x(), mouse_position.y()); |
57 if (bring_up_titlebar == bring_up_titlebar_) | 58 if (bring_up_titlebar == bring_up_titlebar_) |
58 return; | 59 return; |
59 bring_up_titlebar_ = bring_up_titlebar; | 60 bring_up_titlebar_ = bring_up_titlebar; |
60 panel_manager->BringUpOrDownTitlebars(bring_up_titlebar); | 61 panel_manager->BringUpOrDownTitlebars(bring_up_titlebar); |
61 } | 62 } |
OLD | NEW |