OLD | NEW |
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/options_ui.h" | 5 #include "chrome/browser/ui/webui/options2/options_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
48 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/notification_types.h" | 49 #include "content/public/browser/notification_types.h" |
50 #include "content/public/browser/render_view_host.h" | 50 #include "content/public/browser/render_view_host.h" |
51 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
52 #include "content/public/browser/web_contents_delegate.h" | 52 #include "content/public/browser/web_contents_delegate.h" |
53 #include "content/public/browser/web_ui.h" | 53 #include "content/public/browser/web_ui.h" |
54 #include "grit/chromium_strings.h" | 54 #include "grit/chromium_strings.h" |
55 #include "grit/generated_resources.h" | 55 #include "grit/generated_resources.h" |
56 #include "grit/locale_settings.h" | 56 #include "grit/locale_settings.h" |
57 #include "grit/options2_resources.h" | 57 #include "grit/options_resources.h" |
58 #include "grit/theme_resources.h" | 58 #include "grit/theme_resources.h" |
59 #include "net/base/escape.h" | 59 #include "net/base/escape.h" |
60 #include "ui/base/layout.h" | 60 #include "ui/base/layout.h" |
61 #include "ui/base/resource/resource_bundle.h" | 61 #include "ui/base/resource/resource_bundle.h" |
62 | 62 |
63 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
64 #include "chrome/browser/chromeos/system/pointer_device_observer.h" | 64 #include "chrome/browser/chromeos/system/pointer_device_observer.h" |
65 #include "chrome/browser/ui/webui/options2/chromeos/accounts_options_handler.h" | 65 #include "chrome/browser/ui/webui/options2/chromeos/accounts_options_handler.h" |
66 #include "chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler.h" | 66 #include "chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler.h" |
67 #include "chrome/browser/ui/webui/options2/chromeos/change_picture_options_handl
er.h" | 67 #include "chrome/browser/ui/webui/options2/chromeos/change_picture_options_handl
er.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 if (path == kLocalizedStringsFile) { | 142 if (path == kLocalizedStringsFile) { |
143 // Return dynamically-generated strings from memory. | 143 // Return dynamically-generated strings from memory. |
144 jstemplate_builder::UseVersion2 version; | 144 jstemplate_builder::UseVersion2 version; |
145 std::string strings_js; | 145 std::string strings_js; |
146 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); | 146 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); |
147 response_bytes = base::RefCountedString::TakeString(&strings_js); | 147 response_bytes = base::RefCountedString::TakeString(&strings_js); |
148 } else if (path == kOptionsBundleJsFile) { | 148 } else if (path == kOptionsBundleJsFile) { |
149 // Return (and cache) the options javascript code. | 149 // Return (and cache) the options javascript code. |
150 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 150 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
151 LoadDataResourceBytes(IDR_OPTIONS2_BUNDLE_JS, ui::SCALE_FACTOR_NONE); | 151 LoadDataResourceBytes(IDR_OPTIONS_BUNDLE_JS, ui::SCALE_FACTOR_NONE); |
152 } else { | 152 } else { |
153 // Return (and cache) the main options html page as the default. | 153 // Return (and cache) the main options html page as the default. |
154 response_bytes = ui::ResourceBundle::GetSharedInstance(). | 154 response_bytes = ui::ResourceBundle::GetSharedInstance(). |
155 LoadDataResourceBytes(IDR_OPTIONS2_HTML, ui::SCALE_FACTOR_NONE); | 155 LoadDataResourceBytes(IDR_OPTIONS_HTML, ui::SCALE_FACTOR_NONE); |
156 } | 156 } |
157 | 157 |
158 SendResponse(request_id, response_bytes); | 158 SendResponse(request_id, response_bytes); |
159 } | 159 } |
160 | 160 |
161 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { | 161 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { |
162 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) | 162 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) |
163 return "application/javascript"; | 163 return "application/javascript"; |
164 | 164 |
165 return "text/html"; | 165 return "text/html"; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // Add only if handler's service is enabled. | 387 // Add only if handler's service is enabled. |
388 if (handler->IsEnabled()) { | 388 if (handler->IsEnabled()) { |
389 // Add handler to the list and also pass the ownership. | 389 // Add handler to the list and also pass the ownership. |
390 web_ui()->AddMessageHandler(handler.release()); | 390 web_ui()->AddMessageHandler(handler.release()); |
391 handler_raw->GetLocalizedValues(localized_strings); | 391 handler_raw->GetLocalizedValues(localized_strings); |
392 handlers_.push_back(handler_raw); | 392 handlers_.push_back(handler_raw); |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 } // namespace options2 | 396 } // namespace options2 |
OLD | NEW |