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

Side by Side Diff: chrome/browser/views/options/content_page_view.cc

Issue 160081: Add link to themes gallery.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/options/content_page_view.h" 5 #include "chrome/browser/views/options/content_page_view.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 #include <vssym32.h> 10 #include <vssym32.h>
11 11
12 #include "app/gfx/canvas.h" 12 #include "app/gfx/canvas.h"
13 #include "app/l10n_util.h" 13 #include "app/l10n_util.h"
14 #include "app/resource_bundle.h" 14 #include "app/resource_bundle.h"
15 #include "base/gfx/native_theme.h" 15 #include "base/gfx/native_theme.h"
16 #include "chrome/browser/browser.h"
17 #include "chrome/browser/browser_list.h"
16 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/views/clear_browsing_data.h" 19 #include "chrome/browser/views/clear_browsing_data.h"
18 #include "chrome/browser/views/importer_view.h" 20 #include "chrome/browser/views/importer_view.h"
19 #include "chrome/browser/views/options/options_group_view.h" 21 #include "chrome/browser/views/options/options_group_view.h"
20 #include "chrome/browser/views/options/passwords_exceptions_window_view.h" 22 #include "chrome/browser/views/options/passwords_exceptions_window_view.h"
21 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
22 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
25 #include "grit/locale_settings.h"
23 #include "views/controls/button/radio_button.h" 26 #include "views/controls/button/radio_button.h"
24 #include "views/grid_layout.h" 27 #include "views/grid_layout.h"
25 #include "views/standard_layout.h" 28 #include "views/standard_layout.h"
26 #include "views/widget/widget.h" 29 #include "views/widget/widget.h"
27 #include "views/window/window.h" 30 #include "views/window/window.h"
28 31
29 namespace { 32 namespace {
30 33
31 const int kPasswordSavingRadioGroup = 1; 34 const int kPasswordSavingRadioGroup = 1;
32 const int kFormAutofillRadioGroup = 2; 35 const int kFormAutofillRadioGroup = 2;
33 } // namespace 36 } // namespace
34 37
35 ContentPageView::ContentPageView(Profile* profile) 38 ContentPageView::ContentPageView(Profile* profile)
36 : passwords_exceptions_button_(NULL), 39 : passwords_exceptions_button_(NULL),
37 passwords_group_(NULL), 40 passwords_group_(NULL),
38 passwords_asktosave_radio_(NULL), 41 passwords_asktosave_radio_(NULL),
39 passwords_neversave_radio_(NULL), 42 passwords_neversave_radio_(NULL),
40 form_autofill_asktosave_radio_(NULL), 43 form_autofill_asktosave_radio_(NULL),
41 form_autofill_neversave_radio_(NULL), 44 form_autofill_neversave_radio_(NULL),
42 themes_group_(NULL), 45 themes_group_(NULL),
43 themes_reset_button_(NULL), 46 themes_reset_button_(NULL),
47 themes_gallery_button_(NULL),
44 browsing_data_label_(NULL), 48 browsing_data_label_(NULL),
45 browsing_data_group_(NULL), 49 browsing_data_group_(NULL),
46 import_button_(NULL), 50 import_button_(NULL),
47 clear_data_button_(NULL), 51 clear_data_button_(NULL),
48 OptionsPageView(profile) { 52 OptionsPageView(profile) {
49 } 53 }
50 54
51 ContentPageView::~ContentPageView() { 55 ContentPageView::~ContentPageView() {
52 } 56 }
53 57
(...skipping 22 matching lines...) Expand all
76 UserMetricsRecordAction(L"Options_FormAutofill_Disable", 80 UserMetricsRecordAction(L"Options_FormAutofill_Disable",
77 profile()->GetPrefs()); 81 profile()->GetPrefs());
78 } 82 }
79 ask_to_save_form_autofill_.SetValue(enabled); 83 ask_to_save_form_autofill_.SetValue(enabled);
80 } else if (sender == passwords_exceptions_button_) { 84 } else if (sender == passwords_exceptions_button_) {
81 UserMetricsRecordAction(L"Options_ShowPasswordsExceptions", NULL); 85 UserMetricsRecordAction(L"Options_ShowPasswordsExceptions", NULL);
82 PasswordsExceptionsWindowView::Show(profile()); 86 PasswordsExceptionsWindowView::Show(profile());
83 } else if (sender == themes_reset_button_) { 87 } else if (sender == themes_reset_button_) {
84 UserMetricsRecordAction(L"Options_ThemesReset", profile()->GetPrefs()); 88 UserMetricsRecordAction(L"Options_ThemesReset", profile()->GetPrefs());
85 profile()->ClearTheme(); 89 profile()->ClearTheme();
90 } else if (sender == themes_gallery_button_) {
91 UserMetricsRecordAction(L"Options_ThemesGallery", profile()->GetPrefs());
92 Browser* browser =
93 BrowserList::FindBrowserWithType(profile(), Browser::TYPE_NORMAL);
94
95 if (!browser || !browser->GetSelectedTabContents()) {
96 browser = Browser::Create(profile());
97 browser->OpenURL(GURL(l10n_util::GetString(IDS_THEMES_GALLERY_URL)),
98 GURL(), NEW_WINDOW, PageTransition::LINK);
99 } else {
100 browser->AddTabWithURL(GURL(l10n_util::GetString(IDS_THEMES_GALLERY_URL)),
101 GURL(), PageTransition::LINK, true, -1, false, NULL);
102 }
86 } else if (sender == import_button_) { 103 } else if (sender == import_button_) {
87 views::Window::CreateChromeWindow( 104 views::Window::CreateChromeWindow(
88 GetWindow()->GetNativeWindow(), 105 GetWindow()->GetNativeWindow(),
89 gfx::Rect(), 106 gfx::Rect(),
90 new ImporterView(profile()))->Show(); 107 new ImporterView(profile()))->Show();
91 } else if (sender == clear_data_button_) { 108 } else if (sender == clear_data_button_) {
92 views::Window::CreateChromeWindow( 109 views::Window::CreateChromeWindow(
93 GetWindow()->GetNativeWindow(), 110 GetWindow()->GetNativeWindow(),
94 gfx::Rect(), 111 gfx::Rect(),
95 new ClearBrowsingDataView(profile()))->Show(); 112 new ClearBrowsingDataView(profile()))->Show();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 layout->AddView(form_autofill_neversave_radio_); 262 layout->AddView(form_autofill_neversave_radio_);
246 263
247 form_autofill_group_ = new OptionsGroupView( 264 form_autofill_group_ = new OptionsGroupView(
248 contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), 265 contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME),
249 L"", true); 266 L"", true);
250 } 267 }
251 268
252 void ContentPageView::InitThemesGroup() { 269 void ContentPageView::InitThemesGroup() {
253 themes_reset_button_ = new views::NativeButton(this, 270 themes_reset_button_ = new views::NativeButton(this,
254 l10n_util::GetString(IDS_THEMES_RESET_BUTTON)); 271 l10n_util::GetString(IDS_THEMES_RESET_BUTTON));
272 themes_gallery_button_ = new views::NativeButton(this,
273 l10n_util::GetString(IDS_THEMES_GALLERY_BUTTON));
255 274
256 using views::GridLayout; 275 using views::GridLayout;
257 using views::ColumnSet; 276 using views::ColumnSet;
258 277
259 views::View* contents = new views::View; 278 views::View* contents = new views::View;
260 GridLayout* layout = new GridLayout(contents); 279 GridLayout* layout = new GridLayout(contents);
261 contents->SetLayoutManager(layout); 280 contents->SetLayoutManager(layout);
262 281
263 const int single_column_view_set_id = 1; 282 const int double_column_view_set_id = 1;
264 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); 283 ColumnSet* double_col_set = layout->AddColumnSet(double_column_view_set_id);
265 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, 284 double_col_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
266 GridLayout::USE_PREF, 0, 0); 285 GridLayout::USE_PREF, 0, 0);
286 double_col_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
287 double_col_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
288 GridLayout::USE_PREF, 0, 0);
267 289
268 layout->StartRow(0, single_column_view_set_id); 290 layout->StartRow(0, double_column_view_set_id);
269 layout->AddView(themes_reset_button_); 291 layout->AddView(themes_reset_button_);
292 layout->AddView(themes_gallery_button_);
270 293
271 themes_group_ = new OptionsGroupView( 294 themes_group_ = new OptionsGroupView(
272 contents, l10n_util::GetString(IDS_THEMES_GROUP_NAME), 295 contents, l10n_util::GetString(IDS_THEMES_GROUP_NAME),
273 L"", false); 296 L"", false);
274 } 297 }
275 298
276 void ContentPageView::InitBrowsingDataGroup() { 299 void ContentPageView::InitBrowsingDataGroup() {
277 clear_data_button_ = new views::NativeButton(this, 300 clear_data_button_ = new views::NativeButton(this,
278 l10n_util::GetString(IDS_OPTIONS_CLEAR_DATA_BUTTON)); 301 l10n_util::GetString(IDS_OPTIONS_CLEAR_DATA_BUTTON));
279 import_button_ = new views::NativeButton(this, 302 import_button_ = new views::NativeButton(this,
(...skipping 30 matching lines...) Expand all
310 double_col_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, 333 double_col_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
311 GridLayout::USE_PREF, 0, 0); 334 GridLayout::USE_PREF, 0, 0);
312 layout->StartRow(0, double_column_view_set_id); 335 layout->StartRow(0, double_column_view_set_id);
313 layout->AddView(import_button_); 336 layout->AddView(import_button_);
314 layout->AddView(clear_data_button_); 337 layout->AddView(clear_data_button_);
315 338
316 browsing_data_group_ = new OptionsGroupView( 339 browsing_data_group_ = new OptionsGroupView(
317 contents, l10n_util::GetString(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME), 340 contents, l10n_util::GetString(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME),
318 L"", true); 341 L"", true);
319 } 342 }
OLDNEW
« chrome/app/resources/locale_settings.grd ('K') | « chrome/browser/views/options/content_page_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698