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 "ash/wm/workspace/frame_maximize_button.h" | 5 #include "ash/wm/workspace/frame_maximize_button.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/property_util.h" | 9 #include "ash/wm/property_util.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
11 #include "ash/wm/workspace/phantom_window_controller.h" | 11 #include "ash/wm/workspace/phantom_window_controller.h" |
12 #include "ash/wm/workspace/snap_sizer.h" | 12 #include "ash/wm/workspace/snap_sizer.h" |
| 13 #include "grit/ash_strings.h" |
13 #include "grit/ui_resources.h" | 14 #include "grit/ui_resources.h" |
14 #include "ui/aura/event.h" | 15 #include "ui/aura/event.h" |
15 #include "ui/aura/event_filter.h" | 16 #include "ui/aura/event_filter.h" |
| 17 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
18 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
19 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
20 #include "ui/views/window/non_client_view.h" | 22 #include "ui/views/window/non_client_view.h" |
21 | 23 |
22 using ash::internal::SnapSizer; | 24 using ash::internal::SnapSizer; |
23 | 25 |
24 namespace ash { | 26 namespace ash { |
25 | 27 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 93 |
92 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, | 94 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, |
93 views::NonClientFrameView* frame) | 95 views::NonClientFrameView* frame) |
94 : ImageButton(listener), | 96 : ImageButton(listener), |
95 frame_(frame), | 97 frame_(frame), |
96 is_snap_enabled_(false), | 98 is_snap_enabled_(false), |
97 exceeded_drag_threshold_(false), | 99 exceeded_drag_threshold_(false), |
98 snap_type_(SNAP_NONE) { | 100 snap_type_(SNAP_NONE) { |
99 // TODO(sky): nuke this. It's temporary while we don't have good images. | 101 // TODO(sky): nuke this. It's temporary while we don't have good images. |
100 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); | 102 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); |
| 103 SetTooltipText(l10n_util::GetStringUTF16(IDS_FRAME_MAXIMIZE_BUTTON_TOOLTIP)); |
101 } | 104 } |
102 | 105 |
103 FrameMaximizeButton::~FrameMaximizeButton() { | 106 FrameMaximizeButton::~FrameMaximizeButton() { |
104 } | 107 } |
105 | 108 |
106 bool FrameMaximizeButton::OnMousePressed(const views::MouseEvent& event) { | 109 bool FrameMaximizeButton::OnMousePressed(const views::MouseEvent& event) { |
107 is_snap_enabled_ = event.IsLeftMouseButton(); | 110 is_snap_enabled_ = event.IsLeftMouseButton(); |
108 if (is_snap_enabled_) { | 111 if (is_snap_enabled_) { |
109 snap_sizer_.reset(NULL); | 112 snap_sizer_.reset(NULL); |
110 InstallEventFilter(); | 113 InstallEventFilter(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 break; | 325 break; |
323 case SNAP_MINIMIZE: | 326 case SNAP_MINIMIZE: |
324 frame_->GetWidget()->Minimize(); | 327 frame_->GetWidget()->Minimize(); |
325 break; | 328 break; |
326 default: | 329 default: |
327 NOTREACHED(); | 330 NOTREACHED(); |
328 } | 331 } |
329 } | 332 } |
330 | 333 |
331 } // namespace ash | 334 } // namespace ash |
OLD | NEW |