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

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

Issue 8771018: Prevent a crash in the first run search engine selector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | « no previous file | chrome/browser/ui/views/first_run_search_engine_view.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) 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 "ui/views/controls/button/text_button.h" 13 #include "ui/views/controls/button/text_button.h"
14 #include "ui/views/view.h" 14 #include "ui/views/view.h"
15 #include "ui/views/widget/widget_delegate.h" 15 #include "ui/views/widget/widget_delegate.h"
16 #include "ui/views/window/client_view.h"
16 17
17 class Profile; 18 class Profile;
18 class TemplateURL; 19 class TemplateURL;
19 class TemplateURLService; 20 class TemplateURLService;
20 class ThemeService; 21 class ThemeService;
21 22
22 namespace views { 23 namespace views {
23 class ImageView; 24 class ImageView;
24 class Label; 25 class Label;
25 } 26 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const TemplateURL* search_engine_; 68 const TemplateURL* search_engine_;
68 69
69 // Used for UX testing. Gives slot in which search engine was shown. 70 // Used for UX testing. Gives slot in which search engine was shown.
70 int slot_; 71 int slot_;
71 72
72 DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice); 73 DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice);
73 }; 74 };
74 75
75 // This class displays a large search engine choice dialog view during 76 // This class displays a large search engine choice dialog view during
76 // initial first run import. 77 // initial first run import.
77 class FirstRunSearchEngineView : public views::WidgetDelegateView, 78 class FirstRunSearchEngineView : public views::ClientView,
79 public views::WidgetDelegate,
78 public views::ButtonListener, 80 public views::ButtonListener,
79 public TemplateURLServiceObserver { 81 public TemplateURLServiceObserver {
80 public: 82 public:
81 // |profile| allows us to get the set of imported search engines. 83 // |profile| allows us to get the set of imported search engines.
82 // |randomize| is true if logos are to be displayed in random order. 84 // |randomize| is true if logos are to be displayed in random order.
83 FirstRunSearchEngineView(Profile* profile, bool randomize); 85 FirstRunSearchEngineView(Profile* profile, bool randomize);
84 86
85 virtual ~FirstRunSearchEngineView(); 87 virtual ~FirstRunSearchEngineView();
86 88
87 // Overridden from views::WidgetDelegateView: 89 // Overridden from views::WidgetDelegate:
88 virtual string16 GetWindowTitle() const OVERRIDE; 90 virtual string16 GetWindowTitle() const OVERRIDE;
89 virtual views::View* GetContentsView() OVERRIDE { return this; } 91 virtual views::View* GetContentsView() OVERRIDE;
92 virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
90 virtual void WindowClosing() OVERRIDE; 93 virtual void WindowClosing() OVERRIDE;
94 virtual views::Widget* GetWidget() OVERRIDE;
95 virtual const views::Widget* GetWidget() const OVERRIDE;
96
97 // Overridden from views::ClientView:
98 virtual bool CanClose() OVERRIDE;
91 99
92 // Overridden from views::ButtonListener: 100 // Overridden from views::ButtonListener:
93 virtual void ButtonPressed(views::Button* sender, 101 virtual void ButtonPressed(views::Button* sender,
94 const views::Event& event) OVERRIDE; 102 const views::Event& event) OVERRIDE;
95 103
96 // Overridden from views::View: 104 // Overridden from views::View:
97 virtual gfx::Size GetPreferredSize() OVERRIDE; 105 virtual gfx::Size GetPreferredSize() OVERRIDE;
98 virtual void Layout() OVERRIDE; 106 virtual void Layout() OVERRIDE;
99 virtual void ViewHierarchyChanged(bool is_add, 107 virtual void ViewHierarchyChanged(bool is_add,
100 View* parent, 108 View* parent,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 165
158 // Defaults to true. Indicates that the current message loop should be quit 166 // Defaults to true. Indicates that the current message loop should be quit
159 // when the window is closed. This is false in tests when this dialog does not 167 // when the window is closed. This is false in tests when this dialog does not
160 // spin its own message loop. 168 // spin its own message loop.
161 bool quit_on_closing_; 169 bool quit_on_closing_;
162 170
163 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView); 171 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView);
164 }; 172 };
165 173
166 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ 174 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | 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