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

Side by Side Diff: chrome/browser/ui/webui/options2/browser_options_handler2.cc

Issue 10535026: Move creation and ownership of DownloadManager from the embedder to content. This matches all the o… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros compile Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options2/browser_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 #endif // defined(OS_CHROMEOS) 91 #endif // defined(OS_CHROMEOS)
92 92
93 #if defined(OS_WIN) 93 #if defined(OS_WIN)
94 #include "chrome/installer/util/auto_launch_util.h" 94 #include "chrome/installer/util/auto_launch_util.h"
95 #endif // defined(OS_WIN) 95 #endif // defined(OS_WIN)
96 96
97 #if defined(TOOLKIT_GTK) 97 #if defined(TOOLKIT_GTK)
98 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 98 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
99 #endif // defined(TOOLKIT_GTK) 99 #endif // defined(TOOLKIT_GTK)
100 100
101 using content::BrowserContext;
101 using content::BrowserThread; 102 using content::BrowserThread;
102 using content::DownloadManager; 103 using content::DownloadManager;
103 using content::OpenURLParams; 104 using content::OpenURLParams;
104 using content::Referrer; 105 using content::Referrer;
105 using content::UserMetricsAction; 106 using content::UserMetricsAction;
106 107
107 namespace options2 { 108 namespace options2 {
108 109
109 BrowserOptionsHandler::BrowserOptionsHandler() 110 BrowserOptionsHandler::BrowserOptionsHandler()
110 : template_url_service_(NULL), 111 : template_url_service_(NULL),
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 } 1052 }
1052 1053
1053 void BrowserOptionsHandler::MouseExists(bool exists) { 1054 void BrowserOptionsHandler::MouseExists(bool exists) {
1054 base::FundamentalValue val(exists); 1055 base::FundamentalValue val(exists);
1055 web_ui()->CallJavascriptFunction("BrowserOptions.showMouseControls", val); 1056 web_ui()->CallJavascriptFunction("BrowserOptions.showMouseControls", val);
1056 } 1057 }
1057 #endif 1058 #endif
1058 1059
1059 void BrowserOptionsHandler::HandleAutoOpenButton(const ListValue* args) { 1060 void BrowserOptionsHandler::HandleAutoOpenButton(const ListValue* args) {
1060 content::RecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); 1061 content::RecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"));
1061 DownloadManager* manager = 1062 DownloadManager* manager = BrowserContext::GetDownloadManager(
1062 web_ui()->GetWebContents()->GetBrowserContext()->GetDownloadManager(); 1063 web_ui()->GetWebContents()->GetBrowserContext());
1063 if (manager) 1064 if (manager)
1064 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); 1065 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen();
1065 } 1066 }
1066 1067
1067 void BrowserOptionsHandler::HandleMetricsReportingCheckbox( 1068 void BrowserOptionsHandler::HandleMetricsReportingCheckbox(
1068 const ListValue* args) { 1069 const ListValue* args) {
1069 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) 1070 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
1070 std::string checked_str = UTF16ToUTF8(ExtractStringValue(args)); 1071 std::string checked_str = UTF16ToUTF8(ExtractStringValue(args));
1071 bool enabled = checked_str == "true"; 1072 bool enabled = checked_str == "true";
1072 content::RecordAction( 1073 content::RecordAction(
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 zoom_factors_value.Append(option); 1363 zoom_factors_value.Append(option);
1363 } 1364 }
1364 1365
1365 web_ui()->CallJavascriptFunction( 1366 web_ui()->CallJavascriptFunction(
1366 "BrowserOptions.setupPageZoomSelector", zoom_factors_value); 1367 "BrowserOptions.setupPageZoomSelector", zoom_factors_value);
1367 } 1368 }
1368 1369
1369 void BrowserOptionsHandler::SetupAutoOpenFileTypes() { 1370 void BrowserOptionsHandler::SetupAutoOpenFileTypes() {
1370 // Set the hidden state for the AutoOpenFileTypesResetToDefault button. 1371 // Set the hidden state for the AutoOpenFileTypesResetToDefault button.
1371 // We show the button if the user has any auto-open file types registered. 1372 // We show the button if the user has any auto-open file types registered.
1372 DownloadManager* manager = 1373 DownloadManager* manager = BrowserContext::GetDownloadManager(
1373 web_ui()->GetWebContents()->GetBrowserContext()->GetDownloadManager(); 1374 web_ui()->GetWebContents()->GetBrowserContext());
1374 bool display = manager && 1375 bool display = manager &&
1375 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed(); 1376 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed();
1376 base::FundamentalValue value(display); 1377 base::FundamentalValue value(display);
1377 web_ui()->CallJavascriptFunction( 1378 web_ui()->CallJavascriptFunction(
1378 "BrowserOptions.setAutoOpenFileTypesDisplayed", value); 1379 "BrowserOptions.setAutoOpenFileTypesDisplayed", value);
1379 } 1380 }
1380 1381
1381 void BrowserOptionsHandler::SetupProxySettingsSection() { 1382 void BrowserOptionsHandler::SetupProxySettingsSection() {
1382 #if !defined(OS_CHROMEOS) 1383 #if !defined(OS_CHROMEOS)
1383 // Disable the button if proxy settings are managed by a sysadmin or 1384 // Disable the button if proxy settings are managed by a sysadmin or
(...skipping 23 matching lines...) Expand all
1407 } 1408 }
1408 1409
1409 void BrowserOptionsHandler::SetupSSLConfigSettings() { 1410 void BrowserOptionsHandler::SetupSSLConfigSettings() {
1410 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); 1411 base::FundamentalValue checked(rev_checking_enabled_.GetValue());
1411 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); 1412 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged());
1412 web_ui()->CallJavascriptFunction( 1413 web_ui()->CallJavascriptFunction(
1413 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); 1414 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled);
1414 } 1415 }
1415 1416
1416 } // namespace options2 1417 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698