OLD | NEW |
---|---|
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 #include "chrome/browser/ui/views/first_run_search_engine_view.h" | 5 #include "chrome/browser/ui/views/first_run_search_engine_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/first_run/first_run.h" | |
15 #include "chrome/browser/first_run/first_run_dialog.h" | 16 #include "chrome/browser/first_run/first_run_dialog.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search_engines/search_engine_type.h" | 18 #include "chrome/browser/search_engines/search_engine_type.h" |
18 #include "chrome/browser/search_engines/template_url.h" | 19 #include "chrome/browser/search_engines/template_url.h" |
19 #include "chrome/browser/search_engines/template_url_model.h" | 20 #include "chrome/browser/search_engines/template_url_model.h" |
20 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
22 #include "grit/google_chrome_strings.h" | 23 #include "grit/google_chrome_strings.h" |
23 #include "grit/locale_settings.h" | 24 #include "grit/locale_settings.h" |
24 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
50 | 51 |
51 } // namespace | 52 } // namespace |
52 | 53 |
53 namespace first_run { | 54 namespace first_run { |
54 | 55 |
55 void ShowFirstRunDialog(Profile* profile, | 56 void ShowFirstRunDialog(Profile* profile, |
56 bool randomize_search_engine_experiment) { | 57 bool randomize_search_engine_experiment) { |
57 // If the default search is managed via policy, we don't ask the user to | 58 // If the default search is managed via policy, we don't ask the user to |
58 // choose. | 59 // choose. |
59 TemplateURLModel* model = profile->GetTemplateURLModel(); | 60 TemplateURLModel* model = profile->GetTemplateURLModel(); |
60 if (NULL == model || model->is_default_search_managed()) | 61 if (FirstRun::SearchEngineSelectorRestricted() || model == NULL || |
Avi (use Gerrit)
2011/05/04 20:13:06
!model
Miranda Callahan
2011/05/04 20:15:31
Done.
| |
62 model->is_default_search_managed()) { | |
61 return; | 63 return; |
64 } | |
62 | 65 |
63 views::Window* window = views::Window::CreateChromeWindow( | 66 views::Window* window = views::Window::CreateChromeWindow( |
64 NULL, | 67 NULL, |
65 gfx::Rect(), | 68 gfx::Rect(), |
66 new FirstRunSearchEngineView( | 69 new FirstRunSearchEngineView( |
67 profile, randomize_search_engine_experiment)); | 70 profile, randomize_search_engine_experiment)); |
68 DCHECK(window); | 71 DCHECK(window); |
69 | 72 |
70 window->SetIsAlwaysOnTop(true); | 73 window->SetIsAlwaysOnTop(true); |
71 window->Show(); | 74 window->Show(); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 } | 458 } |
456 | 459 |
457 void FirstRunSearchEngineView::GetAccessibleState( | 460 void FirstRunSearchEngineView::GetAccessibleState( |
458 ui::AccessibleViewState* state) { | 461 ui::AccessibleViewState* state) { |
459 state->role = ui::AccessibilityTypes::ROLE_ALERT; | 462 state->role = ui::AccessibilityTypes::ROLE_ALERT; |
460 } | 463 } |
461 | 464 |
462 std::wstring FirstRunSearchEngineView::GetWindowTitle() const { | 465 std::wstring FirstRunSearchEngineView::GetWindowTitle() const { |
463 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIRSTRUN_DLG_TITLE)); | 466 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIRSTRUN_DLG_TITLE)); |
464 } | 467 } |
OLD | NEW |