| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/mobile_config_ui.h" | 5 #include "chrome/browser/chromeos/ui/mobile_config_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/chromeos/mobile_config.h" | 10 #include "chrome/browser/chromeos/mobile_config.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/ui/host_desktop.h" | |
| 13 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 12 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 14 #include "chrome/browser/ui/singleton_tabs.h" | 13 #include "chrome/browser/ui/singleton_tabs.h" |
| 14 #include "ui/gfx/host_desktop_type.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 namespace mobile_config_ui { | 17 namespace mobile_config_ui { |
| 18 | 18 |
| 19 bool DisplayConfigDialog() { | 19 bool DisplayConfigDialog() { |
| 20 MobileConfig* config = MobileConfig::GetInstance(); | 20 MobileConfig* config = MobileConfig::GetInstance(); |
| 21 if (!config->IsReady()) { | 21 if (!config->IsReady()) { |
| 22 LOG(ERROR) << "MobileConfig not ready"; | 22 LOG(ERROR) << "MobileConfig not ready"; |
| 23 return false; | 23 return false; |
| 24 } | 24 } |
| 25 const MobileConfig::LocaleConfig* locale_config = config->GetLocaleConfig(); | 25 const MobileConfig::LocaleConfig* locale_config = config->GetLocaleConfig(); |
| 26 if (!locale_config) { | 26 if (!locale_config) { |
| 27 LOG(ERROR) << "MobileConfig::LocaleConfig not available"; | 27 LOG(ERROR) << "MobileConfig::LocaleConfig not available"; |
| 28 return false; | 28 return false; |
| 29 } | 29 } |
| 30 std::string setup_url = locale_config->setup_url(); | 30 std::string setup_url = locale_config->setup_url(); |
| 31 if (setup_url.empty()) { | 31 if (setup_url.empty()) { |
| 32 LOG(ERROR) << "MobileConfig setup url is empty"; | 32 LOG(ERROR) << "MobileConfig setup url is empty"; |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 // The mobile device will be managed by the primary user. | 35 // The mobile device will be managed by the primary user. |
| 36 chrome::ScopedTabbedBrowserDisplayer displayer( | 36 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 37 ProfileManager::GetPrimaryUserProfile(), ui::HOST_DESKTOP_TYPE_ASH); | 37 ProfileManager::GetPrimaryUserProfile(), ui::HOST_DESKTOP_TYPE_ASH); |
| 38 chrome::ShowSingletonTab(displayer.browser(), GURL(setup_url)); | 38 chrome::ShowSingletonTab(displayer.browser(), GURL(setup_url)); |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace mobile_config_ui | 42 } // namespace mobile_config_ui |
| 43 } // namespace chromeos | 43 } // namespace chromeos |
| OLD | NEW |