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/options/advanced_contents_view.h" | 5 #include "chrome/browser/views/options/advanced_contents_view.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <cryptuiapi.h> | 9 #include <cryptuiapi.h> |
10 #pragma comment(lib, "cryptui.lib") | 10 #pragma comment(lib, "cryptui.lib") |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/prefs/pref_member.h" | 32 #include "chrome/browser/prefs/pref_member.h" |
33 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
34 #include "chrome/browser/prefs/pref_set_observer.h" | 34 #include "chrome/browser/prefs/pref_set_observer.h" |
35 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 35 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
36 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 36 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
37 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 37 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
38 #include "chrome/browser/profile.h" | 38 #include "chrome/browser/profile.h" |
39 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 39 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
40 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 40 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
41 #include "chrome/browser/shell_dialogs.h" | 41 #include "chrome/browser/shell_dialogs.h" |
| 42 #include "chrome/browser/show_options_url.h" |
42 #include "chrome/browser/views/browser_dialogs.h" | 43 #include "chrome/browser/views/browser_dialogs.h" |
43 #include "chrome/browser/views/clear_data_view.h" | 44 #include "chrome/browser/views/clear_data_view.h" |
44 #include "chrome/browser/views/list_background.h" | 45 #include "chrome/browser/views/list_background.h" |
45 #include "chrome/browser/views/options/content_settings_window_view.h" | 46 #include "chrome/browser/views/options/content_settings_window_view.h" |
46 #include "chrome/browser/views/options/fonts_languages_window_view.h" | 47 #include "chrome/browser/views/options/fonts_languages_window_view.h" |
47 #include "chrome/browser/views/restart_message_box.h" | 48 #include "chrome/browser/views/restart_message_box.h" |
48 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
49 #include "chrome/common/pref_names.h" | 50 #include "chrome/common/pref_names.h" |
50 #include "gfx/canvas_skia.h" | 51 #include "gfx/canvas_skia.h" |
51 #include "gfx/native_theme_win.h" | 52 #include "gfx/native_theme_win.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } else if (sender == clear_data_button_) { | 536 } else if (sender == clear_data_button_) { |
536 UserMetricsRecordAction(UserMetricsAction("Options_ClearData"), NULL); | 537 UserMetricsRecordAction(UserMetricsAction("Options_ClearData"), NULL); |
537 views::Window::CreateChromeWindow( | 538 views::Window::CreateChromeWindow( |
538 GetWindow()->GetNativeWindow(), | 539 GetWindow()->GetNativeWindow(), |
539 gfx::Rect(), | 540 gfx::Rect(), |
540 new ClearDataView(profile()))->Show(); | 541 new ClearDataView(profile()))->Show(); |
541 } | 542 } |
542 } | 543 } |
543 | 544 |
544 void PrivacySection::LinkActivated(views::Link* source, int event_flags) { | 545 void PrivacySection::LinkActivated(views::Link* source, int event_flags) { |
545 if (source == learn_more_link_) { | 546 DCHECK(source == learn_more_link_); |
546 // We open a new browser window so the Options dialog doesn't get lost | 547 browser::ShowOptionsURL( |
547 // behind other windows. | 548 profile(), |
548 Browser* browser = Browser::Create(profile()); | 549 GURL(l10n_util::GetString(IDS_LEARN_MORE_PRIVACY_URL))); |
549 browser->OpenURL(GURL(l10n_util::GetString(IDS_LEARN_MORE_PRIVACY_URL)), | |
550 GURL(), NEW_WINDOW, PageTransition::LINK); | |
551 } | |
552 } | 550 } |
553 | 551 |
554 void PrivacySection::InitControlLayout() { | 552 void PrivacySection::InitControlLayout() { |
555 AdvancedSection::InitControlLayout(); | 553 AdvancedSection::InitControlLayout(); |
556 | 554 |
557 content_settings_button_ = new views::NativeButton( | 555 content_settings_button_ = new views::NativeButton( |
558 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON)); | 556 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON)); |
559 clear_data_button_ = new views::NativeButton( | 557 clear_data_button_ = new views::NativeButton( |
560 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON)); | 558 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON)); |
561 section_description_label_ = new views::Label( | 559 section_description_label_ = new views::Label( |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 bool enabled = enable_background_mode_checkbox_->checked(); | 1321 bool enabled = enable_background_mode_checkbox_->checked(); |
1324 UserMetricsRecordAction(enabled ? | 1322 UserMetricsRecordAction(enabled ? |
1325 UserMetricsAction("Options_BackgroundMode_Enable") : | 1323 UserMetricsAction("Options_BackgroundMode_Enable") : |
1326 UserMetricsAction("Options_BackgroundMode_Disable"), | 1324 UserMetricsAction("Options_BackgroundMode_Disable"), |
1327 profile()->GetPrefs()); | 1325 profile()->GetPrefs()); |
1328 enable_background_mode_.SetValue(enabled); | 1326 enable_background_mode_.SetValue(enabled); |
1329 } | 1327 } |
1330 | 1328 |
1331 void ChromeAppsSection::LinkActivated(views::Link* source, int event_flags) { | 1329 void ChromeAppsSection::LinkActivated(views::Link* source, int event_flags) { |
1332 DCHECK(source == learn_more_link_); | 1330 DCHECK(source == learn_more_link_); |
1333 Browser::Create(profile())->OpenURL( | 1331 browser::ShowOptionsURL( |
1334 GURL(l10n_util::GetString(IDS_LEARN_MORE_BACKGROUND_MODE_URL)), GURL(), | 1332 profile(), |
1335 NEW_WINDOW, PageTransition::LINK); | 1333 GURL(l10n_util::GetString(IDS_LEARN_MORE_BACKGROUND_MODE_URL))); |
1336 } | 1334 } |
1337 | 1335 |
1338 void ChromeAppsSection::InitControlLayout() { | 1336 void ChromeAppsSection::InitControlLayout() { |
1339 AdvancedSection::InitControlLayout(); | 1337 AdvancedSection::InitControlLayout(); |
1340 | 1338 |
1341 GridLayout* layout = new GridLayout(contents_); | 1339 GridLayout* layout = new GridLayout(contents_); |
1342 contents_->SetLayoutManager(layout); | 1340 contents_->SetLayoutManager(layout); |
1343 | 1341 |
1344 AddIndentedColumnSet(layout, 0); | 1342 AddIndentedColumnSet(layout, 0); |
1345 | 1343 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 enable_disable_button_->SetLabel( | 1427 enable_disable_button_->SetLabel( |
1430 l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON)); | 1428 l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON)); |
1431 enable_disable_button_->InvalidateLayout(); | 1429 enable_disable_button_->InvalidateLayout(); |
1432 Layout(); | 1430 Layout(); |
1433 CloudPrintSetupFlow::OpenDialog(profile(), this, | 1431 CloudPrintSetupFlow::OpenDialog(profile(), this, |
1434 GetWindow()->GetNativeWindow()); | 1432 GetWindow()->GetNativeWindow()); |
1435 } | 1433 } |
1436 } else if (sender == manage_printer_button_) { | 1434 } else if (sender == manage_printer_button_) { |
1437 UserMetricsRecordAction( | 1435 UserMetricsRecordAction( |
1438 UserMetricsAction("Options_ManageCloudPrinters"), NULL); | 1436 UserMetricsAction("Options_ManageCloudPrinters"), NULL); |
1439 // Open a new browser window for the management tab. The browser | 1437 browser::ShowOptionsURL( |
1440 // will go away when the user closes that tab. | 1438 profile(), |
1441 Browser* browser = Browser::Create(profile()); | 1439 CloudPrintURL(profile()).GetCloudPrintServiceManageURL()); |
1442 browser->OpenURL(CloudPrintURL(profile()).GetCloudPrintServiceManageURL(), | |
1443 GURL(), NEW_WINDOW, PageTransition::LINK); | |
1444 } | 1440 } |
1445 } | 1441 } |
1446 | 1442 |
1447 void CloudPrintProxySection::OnDialogClosed() { | 1443 void CloudPrintProxySection::OnDialogClosed() { |
1448 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1449 enable_disable_button_->SetEnabled(true); | 1445 enable_disable_button_->SetEnabled(true); |
1450 // If the dialog is canceled, the preference won't change, and so we | 1446 // If the dialog is canceled, the preference won't change, and so we |
1451 // have to revert the button text back to the disabled state. | 1447 // have to revert the button text back to the disabled state. |
1452 if (!Enabled()) { | 1448 if (!Enabled()) { |
1453 enable_disable_button_->SetLabel( | 1449 enable_disable_button_->SetLabel( |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 // AdvancedScrollViewContainer, views::View overrides: | 1692 // AdvancedScrollViewContainer, views::View overrides: |
1697 | 1693 |
1698 void AdvancedScrollViewContainer::Layout() { | 1694 void AdvancedScrollViewContainer::Layout() { |
1699 gfx::Rect lb = GetLocalBounds(false); | 1695 gfx::Rect lb = GetLocalBounds(false); |
1700 | 1696 |
1701 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( | 1697 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( |
1702 gfx::NativeTheme::LIST); | 1698 gfx::NativeTheme::LIST); |
1703 lb.Inset(border.width(), border.height()); | 1699 lb.Inset(border.width(), border.height()); |
1704 scroll_view_->SetBounds(lb); | 1700 scroll_view_->SetBounds(lb); |
1705 } | 1701 } |
OLD | NEW |