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/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/property_util.h" | 10 #include "ash/wm/property_util.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE || | 172 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE || |
173 event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 173 event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
174 ProcessUpdateEvent(event); | 174 ProcessUpdateEvent(event); |
175 return ui::GESTURE_STATUS_CONSUMED; | 175 return ui::GESTURE_STATUS_CONSUMED; |
176 } | 176 } |
177 | 177 |
178 return ImageButton::OnGestureEvent(event); | 178 return ImageButton::OnGestureEvent(event); |
179 } | 179 } |
180 | 180 |
181 gfx::ImageSkia FrameMaximizeButton::GetImageToPaint( | 181 gfx::ImageSkia FrameMaximizeButton::GetImageToPaint() { |
182 ui::ScaleFactor scale_factor) { | |
183 if (is_snap_enabled_) { | 182 if (is_snap_enabled_) { |
184 int id = 0; | 183 int id = 0; |
185 if (frame_->GetWidget()->IsMaximized()) { | 184 if (frame_->GetWidget()->IsMaximized()) { |
186 switch (snap_type_) { | 185 switch (snap_type_) { |
187 case SNAP_LEFT: | 186 case SNAP_LEFT: |
188 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P; | 187 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P; |
189 break; | 188 break; |
190 case SNAP_RIGHT: | 189 case SNAP_RIGHT: |
191 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P; | 190 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P; |
192 break; | 191 break; |
(...skipping 24 matching lines...) Expand all Loading... |
217 case SNAP_MINIMIZE: | 216 case SNAP_MINIMIZE: |
218 id = IDR_AURA_WINDOW_SNAP_MINIMIZE_P; | 217 id = IDR_AURA_WINDOW_SNAP_MINIMIZE_P; |
219 break; | 218 break; |
220 default: | 219 default: |
221 NOTREACHED(); | 220 NOTREACHED(); |
222 } | 221 } |
223 } | 222 } |
224 return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); | 223 return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); |
225 } | 224 } |
226 // Hot and pressed states handled by regular ImageButton. | 225 // Hot and pressed states handled by regular ImageButton. |
227 return ImageButton::GetImageToPaint(scale_factor); | 226 return ImageButton::GetImageToPaint(); |
228 } | 227 } |
229 | 228 |
230 void FrameMaximizeButton::ProcessStartEvent(const views::LocatedEvent& event) { | 229 void FrameMaximizeButton::ProcessStartEvent(const views::LocatedEvent& event) { |
231 DCHECK(is_snap_enabled_); | 230 DCHECK(is_snap_enabled_); |
232 snap_sizer_.reset(NULL); | 231 snap_sizer_.reset(NULL); |
233 InstallEventFilter(); | 232 InstallEventFilter(); |
234 snap_type_ = SNAP_NONE; | 233 snap_type_ = SNAP_NONE; |
235 press_location_ = event.location(); | 234 press_location_ = event.location(); |
236 exceeded_drag_threshold_ = false; | 235 exceeded_drag_threshold_ = false; |
237 update_timer_.Start( | 236 update_timer_.Start( |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 break; | 403 break; |
405 case SNAP_RESTORE: | 404 case SNAP_RESTORE: |
406 frame_->GetWidget()->Restore(); | 405 frame_->GetWidget()->Restore(); |
407 break; | 406 break; |
408 case SNAP_NONE: | 407 case SNAP_NONE: |
409 NOTREACHED(); | 408 NOTREACHED(); |
410 } | 409 } |
411 } | 410 } |
412 | 411 |
413 } // namespace ash | 412 } // namespace ash |
OLD | NEW |