| 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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 68 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 69 #include "chrome/app/nacl_fork_delegate_linux.h" | 69 #include "chrome/app/nacl_fork_delegate_linux.h" |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 #if defined(OS_CHROMEOS) | 72 #if defined(OS_CHROMEOS) |
| 73 #include "base/sys_info.h" | 73 #include "base/sys_info.h" |
| 74 #include "chrome/browser/chromeos/boot_times_loader.h" | 74 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 #if defined(OS_ANDROID) |
| 78 #include "chrome/common/descriptors_android.h" |
| 79 #endif |
| 80 |
| 77 #if defined(TOOLKIT_GTK) | 81 #if defined(TOOLKIT_GTK) |
| 78 #include <gdk/gdk.h> | 82 #include <gdk/gdk.h> |
| 79 #include <glib.h> | 83 #include <glib.h> |
| 80 #include <gtk/gtk.h> | 84 #include <gtk/gtk.h> |
| 81 #endif | 85 #endif |
| 82 | 86 |
| 83 #if defined(USE_X11) | 87 #if defined(USE_X11) |
| 84 #include <stdlib.h> | 88 #include <stdlib.h> |
| 85 #include <string.h> | 89 #include <string.h> |
| 86 #include "ui/base/x/x11_util.h" | 90 #include "ui/base/x/x11_util.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 process_type == switches::kPpapiBrokerProcess || | 588 process_type == switches::kPpapiBrokerProcess || |
| 585 process_type == switches::kPpapiPluginProcess); | 589 process_type == switches::kPpapiPluginProcess); |
| 586 | 590 |
| 587 // TODO(markusheintz): The command line flag --lang is actually processed | 591 // TODO(markusheintz): The command line flag --lang is actually processed |
| 588 // by the CommandLinePrefStore, and made available through the PrefService | 592 // by the CommandLinePrefStore, and made available through the PrefService |
| 589 // via the preference prefs::kApplicationLocale. The browser process uses | 593 // via the preference prefs::kApplicationLocale. The browser process uses |
| 590 // the --lang flag to pass the value of the PrefService in here. Maybe | 594 // the --lang flag to pass the value of the PrefService in here. Maybe |
| 591 // this value could be passed in a different way. | 595 // this value could be passed in a different way. |
| 592 const std::string locale = | 596 const std::string locale = |
| 593 command_line.GetSwitchValueASCII(switches::kLang); | 597 command_line.GetSwitchValueASCII(switches::kLang); |
| 598 #if defined(OS_ANDROID) |
| 599 // The renderer sandbox prevents us from accessing our .pak files directly. |
| 600 // Therefore file descriptors to the .pak files that we need are passed in |
| 601 // at process creation time. |
| 602 int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( |
| 603 kAndroidLocalePakDescriptor); |
| 604 CHECK(locale_pak_fd != -1); |
| 605 ResourceBundle::InitSharedInstanceWithPakFile(locale_pak_fd, false); |
| 606 |
| 607 int extra_pak_keys[] = { |
| 608 kAndroidChromePakDescriptor, |
| 609 kAndroidUIResourcesPakDescriptor, |
| 610 }; |
| 611 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { |
| 612 int pak_fd = |
| 613 base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]); |
| 614 CHECK(pak_fd != -1); |
| 615 ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 616 pak_fd, ui::SCALE_FACTOR_100P); |
| 617 } |
| 618 |
| 619 const std::string loaded_locale = locale; |
| 620 #else |
| 594 const std::string loaded_locale = | 621 const std::string loaded_locale = |
| 595 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); | 622 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); |
| 623 #endif |
| 596 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << | 624 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << |
| 597 locale; | 625 locale; |
| 598 | 626 |
| 599 #if defined(OS_MACOSX) | 627 #if defined(OS_MACOSX) |
| 600 // Update the process name (need resources to get the strings, so | 628 // Update the process name (need resources to get the strings, so |
| 601 // only do this when ResourcesBundle has been initialized). | 629 // only do this when ResourcesBundle has been initialized). |
| 602 SetMacProcessName(command_line); | 630 SetMacProcessName(command_line); |
| 603 #endif // defined(OS_MACOSX) | 631 #endif // defined(OS_MACOSX) |
| 604 } | 632 } |
| 605 | 633 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 748 |
| 721 content::ContentRendererClient* | 749 content::ContentRendererClient* |
| 722 ChromeMainDelegate::CreateContentRendererClient() { | 750 ChromeMainDelegate::CreateContentRendererClient() { |
| 723 return &g_chrome_content_renderer_client.Get(); | 751 return &g_chrome_content_renderer_client.Get(); |
| 724 } | 752 } |
| 725 | 753 |
| 726 content::ContentUtilityClient* | 754 content::ContentUtilityClient* |
| 727 ChromeMainDelegate::CreateContentUtilityClient() { | 755 ChromeMainDelegate::CreateContentUtilityClient() { |
| 728 return &g_chrome_content_utility_client.Get(); | 756 return &g_chrome_content_utility_client.Get(); |
| 729 } | 757 } |
| OLD | NEW |