| 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/chromeos/locale_change_guard.h" | 5 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 16 #include "chrome/browser/lifetime/application_lifetime.h" | 16 #include "chrome/browser/lifetime/application_lifetime.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/ash/ash_util.h" | 18 #include "chrome/browser/ui/ash/ash_util.h" |
| 19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
| 23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| 25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/service_manager_connection.h" | 27 #include "content/public/common/service_manager_connection.h" |
| 28 #include "content/public/common/service_names.mojom.h" |
| 28 #include "services/service_manager/public/cpp/connector.h" | 29 #include "services/service_manager/public/cpp/connector.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 | 31 |
| 31 using base::UserMetricsAction; | 32 using base::UserMetricsAction; |
| 32 using content::WebContents; | 33 using content::WebContents; |
| 33 | 34 |
| 34 namespace chromeos { | 35 namespace chromeos { |
| 35 | 36 |
| 36 namespace { | 37 namespace { |
| 37 | 38 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 68 content::ServiceManagerConnection::GetForProcess(); | 69 content::ServiceManagerConnection::GetForProcess(); |
| 69 service_manager::Connector* connector = | 70 service_manager::Connector* connector = |
| 70 connection ? connection->GetConnector() : nullptr; | 71 connection ? connection->GetConnector() : nullptr; |
| 71 // Unit tests may not have a connector. | 72 // Unit tests may not have a connector. |
| 72 if (!connector) | 73 if (!connector) |
| 73 return; | 74 return; |
| 74 | 75 |
| 75 if (chrome::IsRunningInMash()) { | 76 if (chrome::IsRunningInMash()) { |
| 76 connector->ConnectToInterface("ash", ¬ification_controller_); | 77 connector->ConnectToInterface("ash", ¬ification_controller_); |
| 77 } else { | 78 } else { |
| 78 connector->ConnectToInterface("content_browser", ¬ification_controller_); | 79 connector->ConnectToInterface(content::mojom::kBrowserServiceName, |
| 80 ¬ification_controller_); |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 | 83 |
| 82 void LocaleChangeGuard::RevertLocaleChange() { | 84 void LocaleChangeGuard::RevertLocaleChange() { |
| 83 if (profile_ == NULL || | 85 if (profile_ == NULL || |
| 84 from_locale_.empty() || | 86 from_locale_.empty() || |
| 85 to_locale_.empty()) { | 87 to_locale_.empty()) { |
| 86 NOTREACHED(); | 88 NOTREACHED(); |
| 87 return; | 89 return; |
| 88 } | 90 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 LocaleChangeGuard::GetSkipShowNotificationLanguagesForTesting() { | 271 LocaleChangeGuard::GetSkipShowNotificationLanguagesForTesting() { |
| 270 return kSkipShowNotificationLanguages; | 272 return kSkipShowNotificationLanguages; |
| 271 } | 273 } |
| 272 | 274 |
| 273 // static | 275 // static |
| 274 size_t LocaleChangeGuard::GetSkipShowNotificationLanguagesSizeForTesting() { | 276 size_t LocaleChangeGuard::GetSkipShowNotificationLanguagesSizeForTesting() { |
| 275 return arraysize(kSkipShowNotificationLanguages); | 277 return arraysize(kSkipShowNotificationLanguages); |
| 276 } | 278 } |
| 277 | 279 |
| 278 } // namespace chromeos | 280 } // namespace chromeos |
| OLD | NEW |