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

Side by Side Diff: chrome/browser/ui/cocoa/first_run_bubble_controller.mm

Issue 9969141: Add FirstRun.SearchEngineBubble UMA histogram counts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a histogram instead; also count impressions. Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/ui/gtk/first_run_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h"
8 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/first_run/first_run.h"
9 #include "chrome/browser/search_engines/util.h" 11 #include "chrome/browser/search_engines/util.h"
10 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
11 #import "chrome/browser/ui/cocoa/l10n_util.h" 13 #import "chrome/browser/ui/cocoa/l10n_util.h"
12 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 14 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
13 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
15 17
16 @interface FirstRunBubbleController(Private) 18 @interface FirstRunBubbleController(Private)
17 - (id)initRelativeToView:(NSView*)view 19 - (id)initRelativeToView:(NSView*)view
18 offset:(NSPoint)offset 20 offset:(NSPoint)offset
(...skipping 25 matching lines...) Expand all
44 // the omnibox. This happens if the bubble never became key, due to it 46 // the omnibox. This happens if the bubble never became key, due to it
45 // showing up so early in the startup sequence. As a workaround, close it 47 // showing up so early in the startup sequence. As a workaround, close it
46 // automatically after a few seconds if it doesn't become key. 48 // automatically after a few seconds if it doesn't become key.
47 // http://crbug.com/52726 49 // http://crbug.com/52726
48 [self performSelector:@selector(closeIfNotKey) withObject:nil afterDelay:3]; 50 [self performSelector:@selector(closeIfNotKey) withObject:nil afterDelay:3];
49 } 51 }
50 return self; 52 return self;
51 } 53 }
52 54
53 - (void)awakeFromNib { 55 - (void)awakeFromNib {
56 HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble",
Ilya Sherman 2012/04/04 23:28:35 This should be an UMA_HISTOGRAM_ENUMERATION, so th
msw 2012/04/04 23:50:40 Done.
57 first_run::FIRST_RUN_BUBBLE_SHOWN,
58 first_run::NUM_FIRST_RUN_BUBBLE_METRICS);
59
54 DCHECK(header_); 60 DCHECK(header_);
55 [header_ setStringValue:cocoa_l10n_util::ReplaceNSStringPlaceholders( 61 [header_ setStringValue:cocoa_l10n_util::ReplaceNSStringPlaceholders(
56 [header_ stringValue], GetDefaultSearchEngineName(profile_), NULL)]; 62 [header_ stringValue], GetDefaultSearchEngineName(profile_), NULL)];
57 63
58 // Adapt window size to contents. Do this before all other layouting. 64 // Adapt window size to contents. Do this before all other layouting.
59 CGFloat dy = cocoa_l10n_util::VerticallyReflowGroup([[self bubble] subviews]); 65 CGFloat dy = cocoa_l10n_util::VerticallyReflowGroup([[self bubble] subviews]);
60 NSSize ds = NSMakeSize(0, dy); 66 NSSize ds = NSMakeSize(0, dy);
61 ds = [[self bubble] convertSize:ds toView:nil]; 67 ds = [[self bubble] convertSize:ds toView:nil];
62 68
63 NSRect frame = [[self window] frame]; 69 NSRect frame = [[self window] frame];
(...skipping 10 matching lines...) Expand all
74 object:nil]; 80 object:nil];
75 [super close]; 81 [super close];
76 } 82 }
77 83
78 - (void)closeIfNotKey { 84 - (void)closeIfNotKey {
79 if (![[self window] isKeyWindow]) 85 if (![[self window] isKeyWindow])
80 [self close]; 86 [self close];
81 } 87 }
82 88
83 - (IBAction)onChange:(id)sender { 89 - (IBAction)onChange:(id)sender {
90 HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble",
Ilya Sherman 2012/04/04 23:28:35 nit: I would recommend having a single LogFirstRun
msw 2012/04/04 23:50:40 Done.
91 first_run::FIRST_RUN_BUBBLE_CHANGE_SEARCH_INVOKED,
92 first_run::NUM_FIRST_RUN_BUBBLE_METRICS);
93
84 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 94 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
85 [self close]; 95 [self close];
86 if (browser) 96 if (browser)
87 browser->OpenSearchEngineOptionsDialog(); 97 browser->OpenSearchEngineOptionsDialog();
88 } 98 }
89 99
90 @end // FirstRunBubbleController 100 @end // FirstRunBubbleController
OLDNEW
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/ui/gtk/first_run_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698