| 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/login/help_app_launcher.h" | 5 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 13 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/profiles/profile.h" | |
| 14 #include "chrome/browser/profiles/profile_manager.h" | |
| 15 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 16 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 18 | 17 |
| 19 using content::BrowserThread; | 18 using content::BrowserThread; |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 const char kHelpAppFormat[] = | 22 const char kHelpAppFormat[] = |
| 24 "chrome-extension://honijodknafkokifofgiaalefdiedpko/oobe.html?id=%d"; | 23 "chrome-extension://honijodknafkokifofgiaalefdiedpko/oobe.html?id=%d"; |
| 25 | 24 |
| 26 } // namespace | 25 } // namespace |
| 27 | 26 |
| 28 namespace chromeos { | 27 namespace chromeos { |
| 29 | 28 |
| 30 /////////////////////////////////////////////////////////////////////////////// | 29 /////////////////////////////////////////////////////////////////////////////// |
| 31 // HelpApp, public: | 30 // HelpApp, public: |
| 32 | 31 |
| 33 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) | 32 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) |
| 34 : parent_window_(parent_window) { | 33 : parent_window_(parent_window) { |
| 35 } | 34 } |
| 36 | 35 |
| 37 void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { | 36 void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { |
| 38 Profile* profile = ProfileManager::GetDefaultProfile(); | 37 Profile* profile = ProfileHelper::GetSigninProfile(); |
| 39 ExtensionService* service = | 38 ExtensionService* service = |
| 40 extensions::ExtensionSystem::Get(profile)->extension_service(); | 39 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 41 | 40 |
| 42 DCHECK(service); | 41 DCHECK(service); |
| 43 if (!service) | 42 if (!service) |
| 44 return; | 43 return; |
| 45 | 44 |
| 46 GURL url(base::StringPrintf(kHelpAppFormat, | 45 GURL url(base::StringPrintf(kHelpAppFormat, |
| 47 static_cast<int>(help_topic_id))); | 46 static_cast<int>(help_topic_id))); |
| 48 // HelpApp component extension presents only in official builds so we can | 47 // HelpApp component extension presents only in official builds so we can |
| (...skipping 16 matching lines...) Expand all Loading... |
| 65 NULL, | 64 NULL, |
| 66 parent_window_, | 65 parent_window_, |
| 67 l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), | 66 l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), |
| 68 topic_url, | 67 topic_url, |
| 69 LoginWebDialog::STYLE_BUBBLE); | 68 LoginWebDialog::STYLE_BUBBLE); |
| 70 dialog->Show(); | 69 dialog->Show(); |
| 71 // The dialog object will be deleted on dialog close. | 70 // The dialog object will be deleted on dialog close. |
| 72 } | 71 } |
| 73 | 72 |
| 74 } // namespace chromeos | 73 } // namespace chromeos |
| OLD | NEW |