| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace chromeos { |
| 27 | 27 |
| 28 /////////////////////////////////////////////////////////////////////////////// | 28 /////////////////////////////////////////////////////////////////////////////// |
| 29 // HelpApp, public: | 29 // HelpApp, public: |
| 30 | 30 |
| 31 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) | 31 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) |
| 32 : parent_window_(parent_window) { | 32 : parent_window_(parent_window) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 HelpAppLauncher::~HelpAppLauncher() {} | |
| 36 | |
| 37 void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { | 35 void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { |
| 38 Profile* profile = ProfileManager::GetDefaultProfile(); | 36 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 39 ExtensionService* service = profile->GetExtensionService(); | 37 ExtensionService* service = profile->GetExtensionService(); |
| 40 | 38 |
| 41 DCHECK(service); | 39 DCHECK(service); |
| 42 if (!service) | 40 if (!service) |
| 43 return; | 41 return; |
| 44 | 42 |
| 45 GURL url(base::StringPrintf(kHelpAppFormat, | 43 GURL url(base::StringPrintf(kHelpAppFormat, |
| 46 static_cast<int>(help_topic_id))); | 44 static_cast<int>(help_topic_id))); |
| 47 // HelpApp component extension presents only in official builds so we can | 45 // HelpApp component extension presents only in official builds so we can |
| 48 // show help only when the extensions is installed. | 46 // show help only when the extensions is installed. |
| 49 if (service->extensions()->GetByID(url.host())) | 47 if (service->extensions()->GetByID(url.host())) |
| 50 ShowHelpTopicDialog(GURL(url)); | 48 ShowHelpTopicDialog(GURL(url)); |
| 51 } | 49 } |
| 52 | 50 |
| 53 /////////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////////// |
| 52 // HelpApp, protected: |
| 53 |
| 54 HelpAppLauncher::~HelpAppLauncher() {} |
| 55 |
| 56 /////////////////////////////////////////////////////////////////////////////// |
| 54 // HelpApp, private: | 57 // HelpApp, private: |
| 55 | 58 |
| 56 void HelpAppLauncher::ShowHelpTopicDialog(const GURL& topic_url) { | 59 void HelpAppLauncher::ShowHelpTopicDialog(const GURL& topic_url) { |
| 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 58 dialog_.reset(new LoginWebDialog( | 61 dialog_.reset(new LoginWebDialog( |
| 59 this, | 62 this, |
| 60 parent_window_, | 63 parent_window_, |
| 61 l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), | 64 l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), |
| 62 topic_url, | 65 topic_url, |
| 63 LoginWebDialog::STYLE_BUBBLE)); | 66 LoginWebDialog::STYLE_BUBBLE)); |
| 64 dialog_->Show(); | 67 dialog_->Show(); |
| 65 } | 68 } |
| 66 | 69 |
| 67 } // namespace chromeos | 70 } // namespace chromeos |
| OLD | NEW |