Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: ash/frame/caption_buttons/frame_caption_button_container_view.cc

Issue 2099443002: Migrate simple ash Shell metrics users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile error. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame/caption_buttons/frame_caption_button_container_view.h" 5 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <map> 8 #include <map>
9 9
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
11 #include "ash/common/wm_shell.h"
11 #include "ash/frame/caption_buttons/frame_caption_button.h" 12 #include "ash/frame/caption_buttons/frame_caption_button.h"
12 #include "ash/frame/caption_buttons/frame_size_button.h" 13 #include "ash/frame/caption_buttons/frame_size_button.h"
13 #include "ash/metrics/user_metrics_recorder.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/touch/touch_uma.h" 15 #include "ash/touch/touch_uma.h"
16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 16 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
17 #include "ui/base/hit_test.h" 17 #include "ui/base/hit_test.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 19 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
20 #include "ui/gfx/animation/slide_animation.h" 20 #include "ui/gfx/animation/slide_animation.h"
21 #include "ui/gfx/animation/tween.h" 21 #include "ui/gfx/animation/tween.h"
22 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/geometry/insets.h" 23 #include "ui/gfx/geometry/insets.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 return !Shell::GetInstance()->maximize_mode_controller()-> 313 return !Shell::GetInstance()->maximize_mode_controller()->
314 IsMaximizeModeWindowManagerEnabled() && 314 IsMaximizeModeWindowManagerEnabled() &&
315 frame_->widget_delegate()->CanMaximize(); 315 frame_->widget_delegate()->CanMaximize();
316 } 316 }
317 317
318 void FrameCaptionButtonContainerView::ButtonPressed(views::Button* sender, 318 void FrameCaptionButtonContainerView::ButtonPressed(views::Button* sender,
319 const ui::Event& event) { 319 const ui::Event& event) {
320 // Abort any animations of the button icons. 320 // Abort any animations of the button icons.
321 SetButtonsToNormal(ANIMATE_NO); 321 SetButtonsToNormal(ANIMATE_NO);
322 322
323 ash::UserMetricsAction action = 323 UserMetricsAction action = UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MINIMIZE;
324 ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MINIMIZE;
325 if (sender == minimize_button_) { 324 if (sender == minimize_button_) {
326 frame_->Minimize(); 325 frame_->Minimize();
327 } else if (sender == size_button_) { 326 } else if (sender == size_button_) {
328 if (frame_->IsFullscreen()) { // Can be clicked in immersive fullscreen. 327 if (frame_->IsFullscreen()) { // Can be clicked in immersive fullscreen.
329 frame_->Restore(); 328 frame_->Restore();
330 action = ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_EXIT_FULLSCREEN; 329 action = UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_EXIT_FULLSCREEN;
331 } else if (frame_->IsMaximized()) { 330 } else if (frame_->IsMaximized()) {
332 frame_->Restore(); 331 frame_->Restore();
333 action = ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_RESTORE; 332 action = UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_RESTORE;
334 } else { 333 } else {
335 frame_->Maximize(); 334 frame_->Maximize();
336 action = ash::UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MAXIMIZE; 335 action = UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MAXIMIZE;
337 } 336 }
338 337
339 if (event.IsGestureEvent()) { 338 if (event.IsGestureEvent()) {
340 TouchUMA::GetInstance()->RecordGestureAction( 339 TouchUMA::GetInstance()->RecordGestureAction(
341 TouchUMA::GESTURE_FRAMEMAXIMIZE_TAP); 340 TouchUMA::GESTURE_FRAMEMAXIMIZE_TAP);
342 } 341 }
343 } else if (sender == close_button_) { 342 } else if (sender == close_button_) {
344 frame_->Close(); 343 frame_->Close();
345 action = ash::UMA_WINDOW_CLOSE_BUTTON_CLICK; 344 action = UMA_WINDOW_CLOSE_BUTTON_CLICK;
346 } else { 345 } else {
347 return; 346 return;
348 } 347 }
349 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); 348 WmShell::Get()->RecordUserMetricsAction(action);
350 } 349 }
351 350
352 bool FrameCaptionButtonContainerView::IsMinimizeButtonVisible() const { 351 bool FrameCaptionButtonContainerView::IsMinimizeButtonVisible() const {
353 return minimize_button_->visible(); 352 return minimize_button_->visible();
354 } 353 }
355 354
356 void FrameCaptionButtonContainerView::SetButtonsToNormal(Animate animate) { 355 void FrameCaptionButtonContainerView::SetButtonsToNormal(Animate animate) {
357 SetButtonIcons(CAPTION_BUTTON_ICON_MINIMIZE, CAPTION_BUTTON_ICON_CLOSE, 356 SetButtonIcons(CAPTION_BUTTON_ICON_MINIMIZE, CAPTION_BUTTON_ICON_CLOSE,
358 animate); 357 animate);
359 minimize_button_->SetState(views::Button::STATE_NORMAL); 358 minimize_button_->SetState(views::Button::STATE_NORMAL);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 views::Button::ButtonState new_state = views::Button::STATE_NORMAL; 410 views::Button::ButtonState new_state = views::Button::STATE_NORMAL;
412 if (button == to_hover) 411 if (button == to_hover)
413 new_state = views::Button::STATE_HOVERED; 412 new_state = views::Button::STATE_HOVERED;
414 else if (button == to_press) 413 else if (button == to_press)
415 new_state = views::Button::STATE_PRESSED; 414 new_state = views::Button::STATE_PRESSED;
416 button->SetState(new_state); 415 button->SetState(new_state);
417 } 416 }
418 } 417 }
419 418
420 } // namespace ash 419 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/exit_warning_handler.cc ('k') | ash/frame/caption_buttons/frame_size_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698