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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE || | 173 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE || |
174 event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 174 event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
175 ProcessUpdateEvent(event); | 175 ProcessUpdateEvent(event); |
176 return ui::GESTURE_STATUS_CONSUMED; | 176 return ui::GESTURE_STATUS_CONSUMED; |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 return ImageButton::OnGestureEvent(event); | 180 return ImageButton::OnGestureEvent(event); |
181 } | 181 } |
182 | 182 |
183 gfx::ImageSkia FrameMaximizeButton::GetImageToPaint( | 183 gfx::ImageSkia FrameMaximizeButton::GetImageToPaint() { |
184 ui::ScaleFactor scale_factor) { | |
185 if (is_snap_enabled_) { | 184 if (is_snap_enabled_) { |
186 int id = 0; | 185 int id = 0; |
187 if (frame_->GetWidget()->IsMaximized()) { | 186 if (frame_->GetWidget()->IsMaximized()) { |
188 switch (snap_type_) { | 187 switch (snap_type_) { |
189 case SNAP_LEFT: | 188 case SNAP_LEFT: |
190 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P; | 189 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P; |
191 break; | 190 break; |
192 case SNAP_RIGHT: | 191 case SNAP_RIGHT: |
193 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P; | 192 id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P; |
194 break; | 193 break; |
(...skipping 24 matching lines...) Expand all Loading... |
219 case SNAP_MINIMIZE: | 218 case SNAP_MINIMIZE: |
220 id = IDR_AURA_WINDOW_SNAP_MINIMIZE_P; | 219 id = IDR_AURA_WINDOW_SNAP_MINIMIZE_P; |
221 break; | 220 break; |
222 default: | 221 default: |
223 NOTREACHED(); | 222 NOTREACHED(); |
224 } | 223 } |
225 } | 224 } |
226 return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); | 225 return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToImageSkia(); |
227 } | 226 } |
228 // Hot and pressed states handled by regular ImageButton. | 227 // Hot and pressed states handled by regular ImageButton. |
229 return ImageButton::GetImageToPaint(scale_factor); | 228 return ImageButton::GetImageToPaint(); |
230 } | 229 } |
231 | 230 |
232 void FrameMaximizeButton::ProcessStartEvent(const views::LocatedEvent& event) { | 231 void FrameMaximizeButton::ProcessStartEvent(const views::LocatedEvent& event) { |
233 DCHECK(is_snap_enabled_); | 232 DCHECK(is_snap_enabled_); |
234 snap_sizer_.reset(NULL); | 233 snap_sizer_.reset(NULL); |
235 InstallEventFilter(); | 234 InstallEventFilter(); |
236 snap_type_ = SNAP_NONE; | 235 snap_type_ = SNAP_NONE; |
237 press_location_ = event.location(); | 236 press_location_ = event.location(); |
238 exceeded_drag_threshold_ = false; | 237 exceeded_drag_threshold_ = false; |
239 update_timer_.Start( | 238 update_timer_.Start( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 break; | 412 break; |
414 case SNAP_RESTORE: | 413 case SNAP_RESTORE: |
415 frame_->GetWidget()->Restore(); | 414 frame_->GetWidget()->Restore(); |
416 break; | 415 break; |
417 case SNAP_NONE: | 416 case SNAP_NONE: |
418 NOTREACHED(); | 417 NOTREACHED(); |
419 } | 418 } |
420 } | 419 } |
421 | 420 |
422 } // namespace ash | 421 } // namespace ash |
OLD | NEW |