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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 9 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 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" 5 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/user_metrics.h"
10 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
11 #import "chrome/browser/ui/cocoa/l10n_util.h" 12 #import "chrome/browser/ui/cocoa/l10n_util.h"
12 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 13 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
13 #include "content/public/browser/user_metrics.h"
14 #include "ui/gfx/animation/animation.h" 14 #include "ui/gfx/animation/animation.h"
15 #include "ui/gfx/animation/animation_delegate.h" 15 #include "ui/gfx/animation/animation_delegate.h"
16 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
17 17
18 namespace { 18 namespace {
19 19
20 // The minimum required click-to-select area of an inactive tab before allowing 20 // The minimum required click-to-select area of an inactive tab before allowing
21 // the click-to-mute functionality to be enabled. This value is in terms of 21 // the click-to-mute functionality to be enabled. This value is in terms of
22 // some percentage of the AlertIndicatorButton's width. See comments in the 22 // some percentage of the AlertIndicatorButton's width. See comments in the
23 // updateEnabledForMuteToggle method. 23 // updateEnabledForMuteToggle method.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 - (void)handleClick:(id)sender { 235 - (void)handleClick:(id)sender {
236 [self enterDormantPeriod]; 236 [self enterDormantPeriod];
237 237
238 // Call |-transitionToAlertState| to change the image, providing the user with 238 // Call |-transitionToAlertState| to change the image, providing the user with
239 // instant feedback. In the very unlikely event that the mute toggle fails, 239 // instant feedback. In the very unlikely event that the mute toggle fails,
240 // |-transitionToAlertState| will be called again, via another code path, to 240 // |-transitionToAlertState| will be called again, via another code path, to
241 // set the image to be consistent with the final outcome. 241 // set the image to be consistent with the final outcome.
242 using base::UserMetricsAction; 242 using base::UserMetricsAction;
243 if (alertState_ == TabAlertState::AUDIO_PLAYING) { 243 if (alertState_ == TabAlertState::AUDIO_PLAYING) {
244 content::RecordAction(UserMetricsAction("AlertIndicatorButton_Mute")); 244 base::RecordAction(UserMetricsAction("AlertIndicatorButton_Mute"));
245 [self transitionToAlertState:TabAlertState::AUDIO_MUTING]; 245 [self transitionToAlertState:TabAlertState::AUDIO_MUTING];
246 } else { 246 } else {
247 DCHECK(alertState_ == TabAlertState::AUDIO_MUTING); 247 DCHECK(alertState_ == TabAlertState::AUDIO_MUTING);
248 content::RecordAction(UserMetricsAction("AlertIndicatorButton_Unmute")); 248 base::RecordAction(UserMetricsAction("AlertIndicatorButton_Unmute"));
249 [self transitionToAlertState:TabAlertState::AUDIO_PLAYING]; 249 [self transitionToAlertState:TabAlertState::AUDIO_PLAYING];
250 } 250 }
251 251
252 [clickTarget_ performSelector:clickAction_ withObject:self]; 252 [clickTarget_ performSelector:clickAction_ withObject:self];
253 } 253 }
254 254
255 - (void)updateEnabledForMuteToggle { 255 - (void)updateEnabledForMuteToggle {
256 const BOOL wasEnabled = [self isEnabled]; 256 const BOOL wasEnabled = [self isEnabled];
257 257
258 BOOL enable = chrome::AreExperimentalMuteControlsEnabled() && 258 BOOL enable = chrome::AreExperimentalMuteControlsEnabled() &&
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 - (void)windowDidChangeTheme { 309 - (void)windowDidChangeTheme {
310 // Force the alert icon to update because the icon color may change based 310 // Force the alert icon to update because the icon color may change based
311 // on the current theme. 311 // on the current theme.
312 [self updateIconForState:alertState_]; 312 [self updateIconForState:alertState_];
313 } 313 }
314 314
315 - (void)windowDidChangeActive { 315 - (void)windowDidChangeActive {
316 } 316 }
317 317
318 @end 318 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698