| 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/webui/options/advanced_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/advanced_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "content/browser/tab_contents/tab_contents_view.h" | 34 #include "content/browser/tab_contents/tab_contents_view.h" |
| 35 #include "content/common/notification_details.h" | 35 #include "content/common/notification_details.h" |
| 36 #include "content/common/notification_type.h" | 36 #include "content/common/notification_type.h" |
| 37 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
| 38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 39 #include "grit/locale_settings.h" | 39 #include "grit/locale_settings.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 41 | 41 |
| 42 #if !defined(OS_CHROMEOS) | 42 #if !defined(OS_CHROMEOS) |
| 43 #include "chrome/browser/browser_process.h" | 43 #include "chrome/browser/browser_process.h" |
| 44 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |
| 44 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 45 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 48 #include "net/base/ssl_config_service_win.h" | 49 #include "net/base/ssl_config_service_win.h" |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 AdvancedOptionsHandler::AdvancedOptionsHandler() { | 52 AdvancedOptionsHandler::AdvancedOptionsHandler() { |
| 52 #if (defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) || defined(OS_MACOSX) | 53 #if (defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) || defined(OS_MACOSX) |
| 53 cloud_print_proxy_ui_enabled_ = true; | 54 cloud_print_proxy_ui_enabled_ = true; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 ask_for_save_location_.SetValue(checked_str == "true"); | 352 ask_for_save_location_.SetValue(checked_str == "true"); |
| 352 } | 353 } |
| 353 | 354 |
| 354 void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index, | 355 void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index, |
| 355 void* params) { | 356 void* params) { |
| 356 UserMetricsRecordAction(UserMetricsAction("Options_SetDownloadDirectory")); | 357 UserMetricsRecordAction(UserMetricsAction("Options_SetDownloadDirectory")); |
| 357 default_download_location_.SetValue(path); | 358 default_download_location_.SetValue(path); |
| 358 SetupDownloadLocationPath(); | 359 SetupDownloadLocationPath(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 void AdvancedOptionsHandler::OnDialogClosed() { | 362 void AdvancedOptionsHandler::OnCloudPrintSetupClosed() { |
| 362 #if !defined(OS_CHROMEOS) | 363 #if !defined(OS_CHROMEOS) |
| 363 if (cloud_print_proxy_ui_enabled_) | 364 if (cloud_print_proxy_ui_enabled_) |
| 364 SetupCloudPrintProxySection(); | 365 SetupCloudPrintProxySection(); |
| 365 #endif | 366 #endif |
| 366 } | 367 } |
| 367 | 368 |
| 368 void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) { | 369 void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) { |
| 369 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); | 370 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); |
| 370 DownloadManager* manager = web_ui_->GetProfile()->GetDownloadManager(); | 371 DownloadManager* manager = web_ui_->GetProfile()->GetDownloadManager(); |
| 371 if (manager) | 372 if (manager) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 440 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
| 440 void AdvancedOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { | 441 void AdvancedOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { |
| 441 UserMetricsRecordAction(UserMetricsAction("Options_ManageSSLCertificates")); | 442 UserMetricsRecordAction(UserMetricsAction("Options_ManageSSLCertificates")); |
| 442 AdvancedOptionsUtilities::ShowManageSSLCertificates(web_ui_->tab_contents()); | 443 AdvancedOptionsUtilities::ShowManageSSLCertificates(web_ui_->tab_contents()); |
| 443 } | 444 } |
| 444 #endif | 445 #endif |
| 445 | 446 |
| 446 #if !defined(OS_CHROMEOS) | 447 #if !defined(OS_CHROMEOS) |
| 447 void AdvancedOptionsHandler::ShowCloudPrintSetupDialog(const ListValue* args) { | 448 void AdvancedOptionsHandler::ShowCloudPrintSetupDialog(const ListValue* args) { |
| 448 UserMetricsRecordAction(UserMetricsAction("Options_EnableCloudPrintProxy")); | 449 UserMetricsRecordAction(UserMetricsAction("Options_EnableCloudPrintProxy")); |
| 450 cloud_print_setup_handler_.reset(new CloudPrintSetupHandler(this)); |
| 449 CloudPrintSetupFlow::OpenDialog( | 451 CloudPrintSetupFlow::OpenDialog( |
| 450 web_ui_->GetProfile(), this, | 452 web_ui_->GetProfile(), cloud_print_setup_handler_->AsWeakPtr(), |
| 451 web_ui_->tab_contents()->GetMessageBoxRootWindow()); | 453 web_ui_->tab_contents()->GetMessageBoxRootWindow()); |
| 452 } | 454 } |
| 453 | 455 |
| 454 void AdvancedOptionsHandler::HandleDisableCloudPrintProxy( | 456 void AdvancedOptionsHandler::HandleDisableCloudPrintProxy( |
| 455 const ListValue* args) { | 457 const ListValue* args) { |
| 456 UserMetricsRecordAction(UserMetricsAction("Options_DisableCloudPrintProxy")); | 458 UserMetricsRecordAction(UserMetricsAction("Options_DisableCloudPrintProxy")); |
| 457 web_ui_->GetProfile()->GetCloudPrintProxyService()->DisableForUser(); | 459 web_ui_->GetProfile()->GetCloudPrintProxyService()->DisableForUser(); |
| 458 } | 460 } |
| 459 | 461 |
| 460 void AdvancedOptionsHandler::ShowCloudPrintManagePage(const ListValue* args) { | 462 void AdvancedOptionsHandler::ShowCloudPrintManagePage(const ListValue* args) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 FundamentalValue useSSL3Value(useSSL3Setting); | 639 FundamentalValue useSSL3Value(useSSL3Setting); |
| 638 web_ui_->CallJavascriptFunction( | 640 web_ui_->CallJavascriptFunction( |
| 639 "options.AdvancedOptions.SetUseSSL3CheckboxState", | 641 "options.AdvancedOptions.SetUseSSL3CheckboxState", |
| 640 useSSL3Value, disabledValue); | 642 useSSL3Value, disabledValue); |
| 641 FundamentalValue useTLS1Value(useTLS1Setting); | 643 FundamentalValue useTLS1Value(useTLS1Setting); |
| 642 web_ui_->CallJavascriptFunction( | 644 web_ui_->CallJavascriptFunction( |
| 643 "options.AdvancedOptions.SetUseTLS1CheckboxState", | 645 "options.AdvancedOptions.SetUseTLS1CheckboxState", |
| 644 useTLS1Value, disabledValue); | 646 useTLS1Value, disabledValue); |
| 645 } | 647 } |
| 646 #endif | 648 #endif |
| OLD | NEW |