| OLD | NEW |
| 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 #include "chrome/browser/views/first_run_bubble.h" | 5 #include "chrome/browser/views/first_run_bubble.h" |
| 6 | 6 |
| 7 #include "app/gfx/font_util.h" | 7 #include "app/gfx/font_util.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "app/win_util.h" | 10 #include "app/win_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
| 13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/browser_window.h" | 14 #include "chrome/browser/browser_window.h" |
| 15 #include "chrome/browser/first_run/first_run.h" | 15 #include "chrome/browser/first_run/first_run.h" |
| 16 #include "chrome/browser/options_window.h" | |
| 17 #include "chrome/browser/search_engines/util.h" | 16 #include "chrome/browser/search_engines/util.h" |
| 18 #include "chrome/browser/metrics/user_metrics.h" | 17 #include "chrome/browser/metrics/user_metrics.h" |
| 19 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
| 20 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 21 #include "grit/locale_settings.h" | 20 #include "grit/locale_settings.h" |
| 22 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 23 #include "views/event.h" | 22 #include "views/event.h" |
| 24 #include "views/controls/button/native_button.h" | 23 #include "views/controls/button/native_button.h" |
| 25 #include "views/controls/button/image_button.h" | 24 #include "views/controls/button/image_button.h" |
| 26 #include "views/controls/label.h" | 25 #include "views/controls/label.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void FirstRunBubbleView::ButtonPressed(views::Button* sender, | 141 void FirstRunBubbleView::ButtonPressed(views::Button* sender, |
| 143 const views::Event& event) { | 142 const views::Event& event) { |
| 144 UserMetrics::RecordAction(UserMetricsAction("FirstRunBubbleView_Clicked"), | 143 UserMetrics::RecordAction(UserMetricsAction("FirstRunBubbleView_Clicked"), |
| 145 profile_); | 144 profile_); |
| 146 bubble_window_->set_fade_away_on_close(true); | 145 bubble_window_->set_fade_away_on_close(true); |
| 147 bubble_window_->Close(); | 146 bubble_window_->Close(); |
| 148 if (change_button_ == sender) { | 147 if (change_button_ == sender) { |
| 149 UserMetrics::RecordAction( | 148 UserMetrics::RecordAction( |
| 150 UserMetricsAction("FirstRunBubbleView_ChangeButton"), | 149 UserMetricsAction("FirstRunBubbleView_ChangeButton"), |
| 151 profile_); | 150 profile_); |
| 151 |
| 152 Browser* browser = BrowserList::GetLastActive(); | 152 Browser* browser = BrowserList::GetLastActive(); |
| 153 if (browser) { | 153 if (browser) { |
| 154 ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH, | 154 browser->OpenSearchEngineOptionsDialog(); |
| 155 browser->profile()); | |
| 156 } | 155 } |
| 157 } | 156 } |
| 158 } | 157 } |
| 159 | 158 |
| 160 void FirstRunBubbleView::Layout() { | 159 void FirstRunBubbleView::Layout() { |
| 161 gfx::Size canvas = GetPreferredSize(); | 160 gfx::Size canvas = GetPreferredSize(); |
| 162 | 161 |
| 163 // The multiline business that follows is dirty hacks to get around | 162 // The multiline business that follows is dirty hacks to get around |
| 164 // bug 1325257. | 163 // bug 1325257. |
| 165 label1_->SetMultiLine(false); | 164 label1_->SetMultiLine(false); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 if (::IsWindowEnabled(GetParent())) | 528 if (::IsWindowEnabled(GetParent())) |
| 530 InfoBubble::OnActivate(action, minimized, window); | 529 InfoBubble::OnActivate(action, minimized, window); |
| 531 } | 530 } |
| 532 | 531 |
| 533 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, | 532 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, |
| 534 bool closed_by_escape) { | 533 bool closed_by_escape) { |
| 535 // Make sure our parent window is re-enabled. | 534 // Make sure our parent window is re-enabled. |
| 536 if (!IsWindowEnabled(GetParent())) | 535 if (!IsWindowEnabled(GetParent())) |
| 537 ::EnableWindow(GetParent(), true); | 536 ::EnableWindow(GetParent(), true); |
| 538 } | 537 } |
| OLD | NEW |