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

Side by Side Diff: chrome/common/chrome_content_client.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/common/chrome_content_client.h" 5 #include "chrome/common/chrome_content_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/stringprintf.h"
13 #include "base/string_split.h" 12 #include "base/string_split.h"
14 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/common/child_process_logging.h" 16 #include "chrome/common/child_process_logging.h"
17 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/pepper_flash.h" 20 #include "chrome/common/pepper_flash.h"
21 #include "chrome/common/render_messages.h" 21 #include "chrome/common/render_messages.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "content/public/common/pepper_plugin_info.h" 23 #include "content/public/common/pepper_plugin_info.h"
24 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
25 #include "grit/common_resources.h" 25 #include "grit/common_resources.h"
26 #include "remoting/client/plugin/pepper_entrypoints.h" 26 #include "remoting/client/plugin/pepper_entrypoints.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/layout.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 #include "webkit/glue/user_agent.h" 30 #include "webkit/glue/user_agent.h"
30 #include "webkit/plugins/npapi/plugin_list.h" 31 #include "webkit/plugins/npapi/plugin_list.h"
31 #include "webkit/plugins/plugin_constants.h" 32 #include "webkit/plugins/plugin_constants.h"
32 33
33 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. 34 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
34 35
35 #if defined(OS_WIN) 36 #if defined(OS_WIN)
36 #include "base/win/registry.h" 37 #include "base/win/registry.h"
37 #include "base/win/windows_version.h" 38 #include "base/win/windows_version.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 chrome::VersionInfo version_info; 409 chrome::VersionInfo version_info;
409 std::string product("Chrome/"); 410 std::string product("Chrome/");
410 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; 411 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0";
411 return webkit_glue::BuildUserAgentFromProduct(product); 412 return webkit_glue::BuildUserAgentFromProduct(product);
412 } 413 }
413 414
414 string16 ChromeContentClient::GetLocalizedString(int message_id) const { 415 string16 ChromeContentClient::GetLocalizedString(int message_id) const {
415 return l10n_util::GetStringUTF16(message_id); 416 return l10n_util::GetStringUTF16(message_id);
416 } 417 }
417 418
418 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { 419 base::StringPiece ChromeContentClient::GetDataResource(
419 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
420 }
421
422 base::StringPiece ChromeContentClient::GetImageResource(
423 int resource_id, 420 int resource_id,
424 float scale_factor) const { 421 ui::ScaleFactor scale_factor) const {
425 // TODO(flackr): Pass scale_factor to ResourceBundle to get best matching 422 return ResourceBundle::GetSharedInstance().GetRawDataResource(
426 // image resource for the given scale factor. 423 resource_id, scale_factor);
427 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
428 } 424 }
429 425
430 #if defined(OS_WIN) 426 #if defined(OS_WIN)
431 bool ChromeContentClient::SandboxPlugin(CommandLine* command_line, 427 bool ChromeContentClient::SandboxPlugin(CommandLine* command_line,
432 sandbox::TargetPolicy* policy) { 428 sandbox::TargetPolicy* policy) {
433 std::wstring plugin_dll = command_line-> 429 std::wstring plugin_dll = command_line->
434 GetSwitchValueNative(switches::kPluginPath); 430 GetSwitchValueNative(switches::kPluginPath);
435 431
436 FilePath builtin_flash; 432 FilePath builtin_flash;
437 if (!PathService::Get(chrome::FILE_FLASH_PLUGIN, &builtin_flash)) 433 if (!PathService::Get(chrome::FILE_FLASH_PLUGIN, &builtin_flash))
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 502
507 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( 503 bool ChromeContentClient::GetBundledFieldTrialPepperFlash(
508 content::PepperPluginInfo* plugin, 504 content::PepperPluginInfo* plugin,
509 bool* override_npapi_flash) { 505 bool* override_npapi_flash) {
510 if (!ConductingPepperFlashFieldTrial()) 506 if (!ConductingPepperFlashFieldTrial())
511 return false; 507 return false;
512 return GetBundledPepperFlash(plugin, override_npapi_flash); 508 return GetBundledPepperFlash(plugin, override_npapi_flash);
513 } 509 }
514 510
515 } // namespace chrome 511 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698