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

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

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 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/options_ui2.h" 5 #include "chrome/browser/ui/webui/options2/options_ui2.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "content/public/browser/web_contents.h" 50 #include "content/public/browser/web_contents.h"
51 #include "content/public/browser/web_contents_delegate.h" 51 #include "content/public/browser/web_contents_delegate.h"
52 #include "content/public/browser/web_ui.h" 52 #include "content/public/browser/web_ui.h"
53 #include "grit/chromium_strings.h" 53 #include "grit/chromium_strings.h"
54 #include "grit/generated_resources.h" 54 #include "grit/generated_resources.h"
55 #include "grit/locale_settings.h" 55 #include "grit/locale_settings.h"
56 #include "grit/options2_resources.h" 56 #include "grit/options2_resources.h"
57 #include "grit/theme_resources.h" 57 #include "grit/theme_resources.h"
58 #include "grit/theme_resources_standard.h" 58 #include "grit/theme_resources_standard.h"
59 #include "net/base/escape.h" 59 #include "net/base/escape.h"
60 #include "ui/base/layout.h"
60 #include "ui/base/resource/resource_bundle.h" 61 #include "ui/base/resource/resource_bundle.h"
61 62
62 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
63 #include "chrome/browser/chromeos/system/pointer_device_observer.h" 64 #include "chrome/browser/chromeos/system/pointer_device_observer.h"
64 #include "chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.h" 65 #include "chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.h"
65 #include "chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.h " 66 #include "chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.h "
66 #include "chrome/browser/ui/webui/options2/chromeos/change_picture_options_handl er2.h" 67 #include "chrome/browser/ui/webui/options2/chromeos/change_picture_options_handl er2.h"
67 #include "chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handle r2.h" 68 #include "chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handle r2.h"
68 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle r2.h" 69 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle r2.h"
69 #include "chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h" 70 #include "chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 if (path == kLocalizedStringsFile) { 144 if (path == kLocalizedStringsFile) {
144 // Return dynamically-generated strings from memory. 145 // Return dynamically-generated strings from memory.
145 jstemplate_builder::UseVersion2 version; 146 jstemplate_builder::UseVersion2 version;
146 std::string strings_js; 147 std::string strings_js;
147 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js); 148 jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js);
148 response_bytes = base::RefCountedString::TakeString(&strings_js); 149 response_bytes = base::RefCountedString::TakeString(&strings_js);
149 } else if (path == kOptionsBundleJsFile) { 150 } else if (path == kOptionsBundleJsFile) {
150 // Return (and cache) the options javascript code. 151 // Return (and cache) the options javascript code.
151 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 152 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
152 IDR_OPTIONS2_BUNDLE_JS); 153 IDR_OPTIONS2_BUNDLE_JS, ui::SCALE_FACTOR_NONE);
153 } else { 154 } else {
154 // Return (and cache) the main options html page as the default. 155 // Return (and cache) the main options html page as the default.
155 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 156 response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
156 IDR_OPTIONS2_HTML); 157 IDR_OPTIONS2_HTML, ui::SCALE_FACTOR_NONE);
157 } 158 }
158 159
159 SendResponse(request_id, response_bytes); 160 SendResponse(request_id, response_bytes);
160 } 161 }
161 162
162 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const { 163 std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const {
163 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile) 164 if (path == kLocalizedStringsFile || path == kOptionsBundleJsFile)
164 return "application/javascript"; 165 return "application/javascript";
165 166
166 return "text/html"; 167 return "text/html";
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 entry->SetString("title", match.description); 349 entry->SetString("title", match.description);
349 entry->SetString("displayURL", match.contents); 350 entry->SetString("displayURL", match.contents);
350 entry->SetString("url", match.destination_url.spec()); 351 entry->SetString("url", match.destination_url.spec());
351 suggestions->Append(entry); 352 suggestions->Append(entry);
352 } 353 }
353 } 354 }
354 355
355 // static 356 // static
356 base::RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { 357 base::RefCountedMemory* OptionsUI::GetFaviconResourceBytes() {
357 return ResourceBundle::GetSharedInstance(). 358 return ResourceBundle::GetSharedInstance().
358 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); 359 LoadDataResourceBytes(IDR_SETTINGS_FAVICON,
360 ui::SCALE_FACTOR_100P);
359 } 361 }
360 362
361 void OptionsUI::InitializeHandlers() { 363 void OptionsUI::InitializeHandlers() {
362 Profile* profile = Profile::FromWebUI(web_ui()); 364 Profile* profile = Profile::FromWebUI(web_ui());
363 DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession()); 365 DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession());
364 366
365 // A new web page DOM has been brought up in an existing renderer, causing 367 // A new web page DOM has been brought up in an existing renderer, causing
366 // this method to be called twice. If that happens, ignore the second call. 368 // this method to be called twice. If that happens, ignore the second call.
367 if (!initialized_handlers_) { 369 if (!initialized_handlers_) {
368 for (size_t i = 0; i < handlers_.size(); ++i) 370 for (size_t i = 0; i < handlers_.size(); ++i)
(...skipping 22 matching lines...) Expand all
391 // Add only if handler's service is enabled. 393 // Add only if handler's service is enabled.
392 if (handler->IsEnabled()) { 394 if (handler->IsEnabled()) {
393 // Add handler to the list and also pass the ownership. 395 // Add handler to the list and also pass the ownership.
394 web_ui()->AddMessageHandler(handler.release()); 396 web_ui()->AddMessageHandler(handler.release());
395 handler_raw->GetLocalizedValues(localized_strings); 397 handler_raw->GetLocalizedValues(localized_strings);
396 handlers_.push_back(handler_raw); 398 handlers_.push_back(handler_raw);
397 } 399 }
398 } 400 }
399 401
400 } // namespace options2 402 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698