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

Side by Side Diff: chrome/browser/ui/views/first_run_bubble.cc

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
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 #include "chrome/browser/ui/views/first_run_bubble.h" 5 #include "chrome/browser/ui/views/first_run_bubble.h"
6 6
7 #include "base/metrics/histogram.h"
7 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/first_run/first_run.h"
8 #include "chrome/browser/search_engines/util.h" 10 #include "chrome/browser/search_engines/util.h"
9 #include "chrome/browser/ui/browser_list.h" 11 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/views/window.h" 12 #include "chrome/browser/ui/views/window.h"
11 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
15 #include "ui/views/controls/link.h" 17 #include "ui/views/controls/link.h"
16 #include "ui/views/layout/grid_layout.h" 18 #include "ui/views/layout/grid_layout.h"
17 #include "ui/views/layout/layout_constants.h" 19 #include "ui/views/layout/layout_constants.h"
18 20
19 namespace { 21 namespace {
20 const int kAnchorVerticalInset = 5; 22 const int kAnchorVerticalInset = 5;
21 const int kTopInset = 1; 23 const int kTopInset = 1;
22 const int kLeftInset = 2; 24 const int kLeftInset = 2;
23 const int kBottomInset = 7; 25 const int kBottomInset = 7;
24 const int kRightInset = 2; 26 const int kRightInset = 2;
25 } // namespace 27 } // namespace
26 28
27 namespace first_run { 29 namespace first_run {
28 void ShowFirstRunDialog(Profile* profile) {} 30 void ShowFirstRunDialog(Profile* profile) {}
29 } // namespace first_run 31 } // namespace first_run
30 32
31 // static 33 // static
32 FirstRunBubble* FirstRunBubble::ShowBubble(Profile* profile, 34 FirstRunBubble* FirstRunBubble::ShowBubble(Profile* profile,
33 views::View* anchor_view) { 35 views::View* anchor_view) {
36 HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble",
37 first_run::FIRST_RUN_BUBBLE_SHOWN,
38 first_run::NUM_FIRST_RUN_BUBBLE_METRICS);
39
34 FirstRunBubble* delegate = new FirstRunBubble(profile, anchor_view); 40 FirstRunBubble* delegate = new FirstRunBubble(profile, anchor_view);
35 browser::CreateViewsBubble(delegate); 41 browser::CreateViewsBubble(delegate);
36 delegate->StartFade(true); 42 delegate->StartFade(true);
37 return delegate; 43 return delegate;
38 } 44 }
39 45
40 void FirstRunBubble::Init() { 46 void FirstRunBubble::Init() {
41 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 47 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
42 const gfx::Font& original_font = rb.GetFont(ResourceBundle::MediumFont); 48 const gfx::Font& original_font = rb.GetFont(ResourceBundle::MediumFont);
43 49
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 89
84 FirstRunBubble::FirstRunBubble(Profile* profile, views::View* anchor_view) 90 FirstRunBubble::FirstRunBubble(Profile* profile, views::View* anchor_view)
85 : views::BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), 91 : views::BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT),
86 profile_(profile) { 92 profile_(profile) {
87 } 93 }
88 94
89 FirstRunBubble::~FirstRunBubble() { 95 FirstRunBubble::~FirstRunBubble() {
90 } 96 }
91 97
92 void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) { 98 void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) {
99 HISTOGRAM_ENUMERATION("FirstRun.SearchEngineBubble",
100 first_run::FIRST_RUN_BUBBLE_CHANGE_SEARCH_INVOKED,
101 first_run::NUM_FIRST_RUN_BUBBLE_METRICS);
102
93 // Get |profile_|'s browser before closing the bubble, which deletes |this|. 103 // Get |profile_|'s browser before closing the bubble, which deletes |this|.
94 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 104 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
95 GetWidget()->Close(); 105 GetWidget()->Close();
96 if (browser) 106 if (browser)
97 browser->OpenSearchEngineOptionsDialog(); 107 browser->OpenSearchEngineOptionsDialog();
98 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698