OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/certificate_manager_dialog_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/certificate_manager_dialog_ui.h" |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/system/input_device_settings.h" | 11 #include "chrome/browser/chromeos/system/input_device_settings.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" | 13 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" |
13 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" | 14 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler
.h" |
14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
16 #include "chromeos/chromeos_constants.h" | 17 #include "chromeos/chromeos_constants.h" |
17 #include "content/public/browser/url_data_source.h" | 18 #include "content/public/browser/url_data_source.h" |
18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_ui.h" | 20 #include "content/public/browser/web_ui.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 std::string CertificateManagerDialogHTMLSource::GetSource() const { | 65 std::string CertificateManagerDialogHTMLSource::GetSource() const { |
65 return chrome::kChromeUICertificateManagerHost; | 66 return chrome::kChromeUICertificateManagerHost; |
66 } | 67 } |
67 | 68 |
68 void CertificateManagerDialogHTMLSource::StartDataRequest( | 69 void CertificateManagerDialogHTMLSource::StartDataRequest( |
69 const std::string& path, | 70 const std::string& path, |
70 int render_process_id, | 71 int render_process_id, |
71 int render_frame_id, | 72 int render_frame_id, |
72 const content::URLDataSource::GotDataCallback& callback) { | 73 const content::URLDataSource::GotDataCallback& callback) { |
73 scoped_refptr<base::RefCountedMemory> response_bytes; | 74 scoped_refptr<base::RefCountedMemory> response_bytes; |
74 webui::SetFontAndTextDirection(localized_strings_.get()); | 75 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 76 webui::SetLoadTimeDataDefaults(app_locale, localized_strings_.get()); |
75 | 77 |
76 if (path == kLocalizedStringsFile) { | 78 if (path == kLocalizedStringsFile) { |
77 // Return dynamically-generated strings from memory. | 79 // Return dynamically-generated strings from memory. |
78 std::string strings_js; | 80 std::string strings_js; |
79 webui::AppendJsonJS(localized_strings_.get(), &strings_js); | 81 webui::AppendJsonJS(localized_strings_.get(), &strings_js); |
80 response_bytes = base::RefCountedString::TakeString(&strings_js); | 82 response_bytes = base::RefCountedString::TakeString(&strings_js); |
81 } else { | 83 } else { |
82 // Return (and cache) the main options html page as the default. | 84 // Return (and cache) the main options html page as the default. |
83 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 85 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
84 LoadDataResourceBytes(IDR_CERT_MANAGER_DIALOG_HTML); | 86 LoadDataResourceBytes(IDR_CERT_MANAGER_DIALOG_HTML); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (!initialized_handlers_) { | 133 if (!initialized_handlers_) { |
132 core_handler_->InitializeHandler(); | 134 core_handler_->InitializeHandler(); |
133 cert_handler_->InitializeHandler(); | 135 cert_handler_->InitializeHandler(); |
134 initialized_handlers_ = true; | 136 initialized_handlers_ = true; |
135 } | 137 } |
136 core_handler_->InitializePage(); | 138 core_handler_->InitializePage(); |
137 cert_handler_->InitializePage(); | 139 cert_handler_->InitializePage(); |
138 } | 140 } |
139 | 141 |
140 } // namespace chromeos | 142 } // namespace chromeos |
OLD | NEW |