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/chromeos/frame/layout_mode_button.h" | 5 #include "chrome/browser/chromeos/frame/layout_mode_button.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/wm_ipc.h" | 9 #include "chrome/browser/chromeos/wm_ipc.h" |
10 #include "content/common/notification_details.h" | 10 #include "content/common/notification_details.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 return size; | 35 return size; |
36 } | 36 } |
37 | 37 |
38 bool LayoutModeButton::HitTest(const gfx::Point& l) const { | 38 bool LayoutModeButton::HitTest(const gfx::Point& l) const { |
39 // Handle events above our bounds so that we'll see clicks occuring in the | 39 // Handle events above our bounds so that we'll see clicks occuring in the |
40 // padding between the top of the screen and the button. | 40 // padding between the top of the screen and the button. |
41 const gfx::Point point(l.x(), std::max(y(), l.y())); | 41 const gfx::Point point(l.x(), std::max(y(), l.y())); |
42 return ImageButton::HitTest(point); | 42 return ImageButton::HitTest(point); |
43 } | 43 } |
44 | 44 |
45 void LayoutModeButton::Observe(NotificationType type, | 45 void LayoutModeButton::Observe(int type, |
46 const NotificationSource& source, | 46 const NotificationSource& source, |
47 const NotificationDetails& details) { | 47 const NotificationDetails& details) { |
48 DCHECK(type == NotificationType::LAYOUT_MODE_CHANGED); | 48 DCHECK(type == chrome::LAYOUT_MODE_CHANGED); |
49 UpdateForCurrentLayoutMode(); | 49 UpdateForCurrentLayoutMode(); |
50 } | 50 } |
51 | 51 |
52 void LayoutModeButton::Init() { | 52 void LayoutModeButton::Init() { |
53 WmIpc* wm_ipc = WmIpc::instance(); | 53 WmIpc* wm_ipc = WmIpc::instance(); |
54 registrar_.Add(this, | 54 registrar_.Add(this, |
55 NotificationType::LAYOUT_MODE_CHANGED, | 55 chrome::LAYOUT_MODE_CHANGED, |
56 Source<WmIpc>(wm_ipc)); | 56 Source<WmIpc>(wm_ipc)); |
57 UpdateForCurrentLayoutMode(); | 57 UpdateForCurrentLayoutMode(); |
58 } | 58 } |
59 | 59 |
60 void LayoutModeButton::ButtonPressed(views::Button* sender, | 60 void LayoutModeButton::ButtonPressed(views::Button* sender, |
61 const views::Event& event) { | 61 const views::Event& event) { |
62 DCHECK_EQ(sender, this); | 62 DCHECK_EQ(sender, this); |
63 WmIpc* wm_ipc = WmIpc::instance(); | 63 WmIpc* wm_ipc = WmIpc::instance(); |
64 const WmIpcLayoutMode mode = wm_ipc->layout_mode(); | 64 const WmIpcLayoutMode mode = wm_ipc->layout_mode(); |
65 | 65 |
(...skipping 25 matching lines...) Expand all Loading... |
91 SetImage(BS_NORMAL, rb.GetBitmapNamed(IDR_STATUSBAR_WINDOW_MAXIMIZE)); | 91 SetImage(BS_NORMAL, rb.GetBitmapNamed(IDR_STATUSBAR_WINDOW_MAXIMIZE)); |
92 SetTooltipText(UTF16ToWide( | 92 SetTooltipText(UTF16ToWide( |
93 l10n_util::GetStringUTF16(IDS_STATUSBAR_WINDOW_MAXIMIZE_TOOLTIP))); | 93 l10n_util::GetStringUTF16(IDS_STATUSBAR_WINDOW_MAXIMIZE_TOOLTIP))); |
94 break; | 94 break; |
95 default: | 95 default: |
96 DLOG(WARNING) << "Unknown layout mode " << mode; | 96 DLOG(WARNING) << "Unknown layout mode " << mode; |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 } // namespace chromeos | 100 } // namespace chromeos |
OLD | NEW |