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

Side by Side Diff: chrome/browser/views/first_run_search_engine_view.h

Issue 2846038: Add UMA logging of search engine selection position when the search engine lo... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 5 #ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/browser/views/keyword_editor_view.h" 10 #include "chrome/browser/views/keyword_editor_view.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 int GetChoiceViewWidth(); 45 int GetChoiceViewWidth();
46 int GetChoiceViewHeight(); 46 int GetChoiceViewHeight();
47 47
48 // Set the bounds for the search engine choice view; called in the 48 // Set the bounds for the search engine choice view; called in the
49 // Layout method, when we know what the new bounds should be. 49 // Layout method, when we know what the new bounds should be.
50 void SetChoiceViewBounds(int x, int y, int width, int height); 50 void SetChoiceViewBounds(int x, int y, int width, int height);
51 51
52 // Accessor for the search engine data this button represents. 52 // Accessor for the search engine data this button represents.
53 const TemplateURL* GetSearchEngine() { return search_engine_; } 53 const TemplateURL* GetSearchEngine() { return search_engine_; }
54 54
55 // Used for UX testing.
56 void set_slot(int slot) { slot_ = slot; }
57 int slot() const { return slot_; }
58
55 private: 59 private:
56 // Either an ImageView of a logo, or a Label with text. Owned by 60 // Either an ImageView of a logo, or a Label with text. Owned by
57 // FirstRunSearchEngineView. 61 // FirstRunSearchEngineView.
58 views::View* choice_view_; 62 views::View* choice_view_;
59 63
60 // True if choice_view_ is holding an ImageView. 64 // True if choice_view_ is holding an ImageView.
61 bool is_image_label_; 65 bool is_image_label_;
62 66
63 // Data for the search engine held here. 67 // Data for the search engine held here.
64 const TemplateURL* search_engine_; 68 const TemplateURL* search_engine_;
65 69
70 // Used for UX testing. Gives slot in which search engine was shown.
71 int slot_;
72
66 DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice); 73 DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice);
67 }; 74 };
68 75
69 // This class receives a callback when the search engine dialog closes. 76 // This class receives a callback when the search engine dialog closes.
70 class SearchEngineSelectionObserver { 77 class SearchEngineSelectionObserver {
71 public: 78 public:
72 virtual ~SearchEngineSelectionObserver() {} 79 virtual ~SearchEngineSelectionObserver() {}
73 // Called when the user has chosen a search engine. 80 // Called when the user has chosen a search engine.
74 virtual void SearchEngineChosen(const TemplateURL* default_search) = 0; 81 virtual void SearchEngineChosen(const TemplateURL* default_search) = 0;
75 }; 82 };
76 83
77 // This class displays a large search engine choice dialog view during 84 // This class displays a large search engine choice dialog view during
78 // initial first run import. 85 // initial first run import.
79 class FirstRunSearchEngineView 86 class FirstRunSearchEngineView
80 : public views::View, 87 : public views::View,
81 public views::ButtonListener, 88 public views::ButtonListener,
82 public views::WindowDelegate, 89 public views::WindowDelegate,
83 public TemplateURLModelObserver { 90 public TemplateURLModelObserver {
84 public: 91 public:
85 // |observer| is the FirstRunView that waits for us to pass back a search 92 // |observer| is the FirstRunView that waits for us to pass back a search
86 // engine choice; |profile| allows us to get the set of imported search 93 // engine choice.
87 // engines, and display the KeywordEditorView on demand; |randomize| 94 // |profile| allows us to get the set of imported search engines, and
88 // is true if logos are to be displayed in random order. 95 // display the KeywordEditorView on demand.
96 // |randomize| is true if logos are to be displayed in random order.
89 FirstRunSearchEngineView(SearchEngineSelectionObserver* observer, 97 FirstRunSearchEngineView(SearchEngineSelectionObserver* observer,
90 Profile* profile, bool randomize); 98 Profile* profile, bool randomize);
91 99
92 virtual ~FirstRunSearchEngineView(); 100 virtual ~FirstRunSearchEngineView();
93 101
94 // Overridden from views::View: 102 // Overridden from views::View:
95 virtual gfx::Size GetPreferredSize(); 103 virtual gfx::Size GetPreferredSize();
96 virtual void Layout(); 104 virtual void Layout();
97 105
98 // Overridden from views::WindowDelegate: 106 // Overridden from views::WindowDelegate:
(...skipping 15 matching lines...) Expand all
114 private: 122 private:
115 // Initializes the labels and controls in the view. 123 // Initializes the labels and controls in the view.
116 void SetupControls(); 124 void SetupControls();
117 125
118 // Owned by the profile_. 126 // Owned by the profile_.
119 TemplateURLModel* search_engines_model_; 127 TemplateURLModel* search_engines_model_;
120 128
121 // One for each search engine choice offered, either three or four. 129 // One for each search engine choice offered, either three or four.
122 std::vector<SearchEngineChoice*> search_engine_choices_; 130 std::vector<SearchEngineChoice*> search_engine_choices_;
123 131
132 // If logos are to be displayed in random order. Used for UX testing.
133 bool randomize_;
134
124 // The profile associated with this import process. 135 // The profile associated with this import process.
125 Profile* profile_; 136 Profile* profile_;
126 137
127 // Gets called back when one of the choice buttons is pressed. 138 // Gets called back when one of the choice buttons is pressed.
128 SearchEngineSelectionObserver* observer_; 139 SearchEngineSelectionObserver* observer_;
129 140
130 bool text_direction_is_rtl_; 141 bool text_direction_is_rtl_;
131 142
132 // If logos are to be displayed in random order. Used for UX testing.
133 bool randomize_;
134
135 // Image of browser search box with grey background and bubble arrow. 143 // Image of browser search box with grey background and bubble arrow.
136 views::ImageView* background_image_; 144 views::ImageView* background_image_;
137 145
138 // UI elements: 146 // UI elements:
139 views::Label* title_label_; 147 views::Label* title_label_;
140 views::Label* text_label_; 148 views::Label* text_label_;
141 149
142 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView); 150 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView);
143 }; 151 };
144 152
145 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 153 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
146 154
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_model.h ('k') | chrome/browser/views/first_run_search_engine_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698