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

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

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/browser/search_engines/template_url_service_observer.h" 11 #include "chrome/browser/search_engines/template_url_service_observer.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 #include "views/controls/button/text_button.h" 13 #include "views/controls/button/text_button.h"
14 #include "views/view.h" 14 #include "views/view.h"
15 #include "views/widget/widget_delegate.h" 15 #include "views/widget/widget_delegate.h"
16 16
17 class Profile; 17 class Profile;
18 class TemplateURL; 18 class TemplateURL;
19 class TemplateURLService; 19 class TemplateURLService;
20 class ThemeService;
20 21
21 namespace views { 22 namespace views {
22 class ImageView; 23 class ImageView;
23 class Label; 24 class Label;
24 } 25 }
25 26
26 // This class holds the logo and TemplateURL for a search engine and serves 27 // This class holds the logo and TemplateURL for a search engine and serves
27 // as its button in the search engine selection view. 28 // as its button in the search engine selection view.
28 class SearchEngineChoice : public views::NativeTextButton { 29 class SearchEngineChoice : public views::NativeTextButton {
29 public: 30 public:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 virtual string16 GetWindowTitle() const OVERRIDE; 88 virtual string16 GetWindowTitle() const OVERRIDE;
88 virtual views::View* GetContentsView() OVERRIDE { return this; } 89 virtual views::View* GetContentsView() OVERRIDE { return this; }
89 90
90 // Overridden from views::ButtonListener: 91 // Overridden from views::ButtonListener:
91 virtual void ButtonPressed(views::Button* sender, 92 virtual void ButtonPressed(views::Button* sender,
92 const views::Event& event) OVERRIDE; 93 const views::Event& event) OVERRIDE;
93 94
94 // Overridden from views::View: 95 // Overridden from views::View:
95 virtual gfx::Size GetPreferredSize() OVERRIDE; 96 virtual gfx::Size GetPreferredSize() OVERRIDE;
96 virtual void Layout() OVERRIDE; 97 virtual void Layout() OVERRIDE;
98 virtual void ViewHierarchyChanged(bool is_add,
99 View* parent,
100 View* child) OVERRIDE;
97 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 101 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
98 102
99 // Override from views::View so we can draw the gray background at dialog top. 103 // Override from views::View so we can draw the gray background at dialog top.
100 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 104 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
101 105
102 // Overridden from TemplateURLServiceObserver. When the search engines have 106 // Overridden from TemplateURLServiceObserver. When the search engines have
103 // loaded from the profile, we can populate the logos in the dialog box 107 // loaded from the profile, we can populate the logos in the dialog box
104 // to present to the user. 108 // to present to the user.
105 virtual void OnTemplateURLServiceChanged() OVERRIDE; 109 virtual void OnTemplateURLServiceChanged() OVERRIDE;
106 110
107 private: 111 private:
108 // Initializes the labels and controls in the view. 112 // Once the TemplateURLService has loaded and we're in a View hierarchy, it's
109 void SetupControls(); 113 // OK to add the search engines from the TemplateURLService.
110 114 void AddSearchEnginesIfPossible();
111 // Owned by the profile_.
112 TemplateURLService* search_engines_model_;
113 115
114 // One for each search engine choice offered, either three or four. 116 // One for each search engine choice offered, either three or four.
115 std::vector<SearchEngineChoice*> search_engine_choices_; 117 std::vector<SearchEngineChoice*> search_engine_choices_;
116 118
117 // If logos are to be displayed in random order. Used for UX testing. 119 // If logos are to be displayed in random order. Used for UX testing.
118 bool randomize_; 120 bool randomize_;
119 121
120 // The profile associated with this import process. 122 // Services associated with the current profile.
121 Profile* profile_; 123 TemplateURLService* template_url_service_;
124 ThemeService* theme_service_;
122 125
123 bool text_direction_is_rtl_; 126 bool text_direction_is_rtl_;
124 127
128 bool template_url_service_loaded_;
129 bool added_to_view_hierarchy_;
130
125 // Image of browser search box with grey background and bubble arrow. 131 // Image of browser search box with grey background and bubble arrow.
126 views::ImageView* background_image_; 132 views::ImageView* background_image_;
127 133
128 // UI elements: 134 // UI elements:
129 views::Label* title_label_; 135 views::Label* title_label_;
130 views::Label* text_label_; 136 views::Label* text_label_;
131 137
132 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView); 138 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView);
133 }; 139 };
134 140
135 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 141 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/first_run_bubble.cc ('k') | chrome/browser/ui/views/first_run_search_engine_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698