| 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 "ash/public/interfaces/constants.mojom.h" |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 16 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 16 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.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 "services/service_manager/public/cpp/connector.h" | 28 #include "services/service_manager/public/cpp/connector.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void LocaleChangeGuard::ConnectToLocaleNotificationController() { | 66 void LocaleChangeGuard::ConnectToLocaleNotificationController() { |
| 67 content::ServiceManagerConnection* connection = | 67 content::ServiceManagerConnection* connection = |
| 68 content::ServiceManagerConnection::GetForProcess(); | 68 content::ServiceManagerConnection::GetForProcess(); |
| 69 service_manager::Connector* connector = | 69 service_manager::Connector* connector = |
| 70 connection ? connection->GetConnector() : nullptr; | 70 connection ? connection->GetConnector() : nullptr; |
| 71 // Unit tests may not have a connector. | 71 // Unit tests may not have a connector. |
| 72 if (!connector) | 72 if (!connector) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 connector->BindInterface(ash_util::GetAshServiceName(), | 75 connector->BindInterface(ash::mojom::kServiceName, ¬ification_controller_); |
| 76 ¬ification_controller_); | |
| 77 } | 76 } |
| 78 | 77 |
| 79 void LocaleChangeGuard::RevertLocaleChange() { | 78 void LocaleChangeGuard::RevertLocaleChange() { |
| 80 if (profile_ == NULL || | 79 if (profile_ == NULL || |
| 81 from_locale_.empty() || | 80 from_locale_.empty() || |
| 82 to_locale_.empty()) { | 81 to_locale_.empty()) { |
| 83 NOTREACHED(); | 82 NOTREACHED(); |
| 84 return; | 83 return; |
| 85 } | 84 } |
| 86 if (reverted_) | 85 if (reverted_) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 LocaleChangeGuard::GetSkipShowNotificationLanguagesForTesting() { | 265 LocaleChangeGuard::GetSkipShowNotificationLanguagesForTesting() { |
| 267 return kSkipShowNotificationLanguages; | 266 return kSkipShowNotificationLanguages; |
| 268 } | 267 } |
| 269 | 268 |
| 270 // static | 269 // static |
| 271 size_t LocaleChangeGuard::GetSkipShowNotificationLanguagesSizeForTesting() { | 270 size_t LocaleChangeGuard::GetSkipShowNotificationLanguagesSizeForTesting() { |
| 272 return arraysize(kSkipShowNotificationLanguages); | 271 return arraysize(kSkipShowNotificationLanguages); |
| 273 } | 272 } |
| 274 | 273 |
| 275 } // namespace chromeos | 274 } // namespace chromeos |
| OLD | NEW |