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

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

Issue 9960046: Merge 130848 - Add FirstRun.SearchEngineBubble UMA histogram counts. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: 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.cc ('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/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/first_run/first_run.h"
9 #include "chrome/browser/search_engines/util.h" 10 #include "chrome/browser/search_engines/util.h"
10 #include "chrome/browser/ui/browser_list.h" 11 #include "chrome/browser/ui/browser_list.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/info_bubble_view.h" 13 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
13 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 @interface FirstRunBubbleController(Private) 17 @interface FirstRunBubbleController(Private)
17 - (id)initRelativeToView:(NSView*)view 18 - (id)initRelativeToView:(NSView*)view
18 offset:(NSPoint)offset 19 offset:(NSPoint)offset
(...skipping 25 matching lines...) Expand all
44 // the omnibox. This happens if the bubble never became key, due to it 45 // 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 46 // 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. 47 // automatically after a few seconds if it doesn't become key.
47 // http://crbug.com/52726 48 // http://crbug.com/52726
48 [self performSelector:@selector(closeIfNotKey) withObject:nil afterDelay:3]; 49 [self performSelector:@selector(closeIfNotKey) withObject:nil afterDelay:3];
49 } 50 }
50 return self; 51 return self;
51 } 52 }
52 53
53 - (void)awakeFromNib { 54 - (void)awakeFromNib {
55 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_SHOWN);
56
54 DCHECK(header_); 57 DCHECK(header_);
55 [header_ setStringValue:cocoa_l10n_util::ReplaceNSStringPlaceholders( 58 [header_ setStringValue:cocoa_l10n_util::ReplaceNSStringPlaceholders(
56 [header_ stringValue], GetDefaultSearchEngineName(profile_), NULL)]; 59 [header_ stringValue], GetDefaultSearchEngineName(profile_), NULL)];
57 60
58 // Adapt window size to contents. Do this before all other layouting. 61 // Adapt window size to contents. Do this before all other layouting.
59 CGFloat dy = cocoa_l10n_util::VerticallyReflowGroup([[self bubble] subviews]); 62 CGFloat dy = cocoa_l10n_util::VerticallyReflowGroup([[self bubble] subviews]);
60 NSSize ds = NSMakeSize(0, dy); 63 NSSize ds = NSMakeSize(0, dy);
61 ds = [[self bubble] convertSize:ds toView:nil]; 64 ds = [[self bubble] convertSize:ds toView:nil];
62 65
63 NSRect frame = [[self window] frame]; 66 NSRect frame = [[self window] frame];
(...skipping 10 matching lines...) Expand all
74 object:nil]; 77 object:nil];
75 [super close]; 78 [super close];
76 } 79 }
77 80
78 - (void)closeIfNotKey { 81 - (void)closeIfNotKey {
79 if (![[self window] isKeyWindow]) 82 if (![[self window] isKeyWindow])
80 [self close]; 83 [self close];
81 } 84 }
82 85
83 - (IBAction)onChange:(id)sender { 86 - (IBAction)onChange:(id)sender {
87 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED);
88
84 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 89 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
85 [self close]; 90 [self close];
86 if (browser) 91 if (browser)
87 browser->OpenSearchEngineOptionsDialog(); 92 browser->OpenSearchEngineOptionsDialog();
88 } 93 }
89 94
90 @end // FirstRunBubbleController 95 @end // FirstRunBubbleController
OLDNEW
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/ui/gtk/first_run_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698