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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/chromeos/login/helper.h" | 11 #include "chrome/browser/chromeos/login/helper.h" |
12 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
13 #include "chrome/browser/extensions/extension_service.h" | |
14 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
15 #include "chrome/grit/locale_settings.h" | 14 #include "chrome/grit/locale_settings.h" |
16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
17 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_registry.h" |
18 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
20 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
21 | 20 |
22 using content::BrowserThread; | 21 using content::BrowserThread; |
22 using extensions::ExtensionRegistry; | |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char kHelpAppFormat[] = | 26 const char kHelpAppFormat[] = |
27 "chrome-extension://honijodknafkokifofgiaalefdiedpko/oobe.html?id=%d"; | 27 "chrome-extension://honijodknafkokifofgiaalefdiedpko/oobe.html?id=%d"; |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 namespace chromeos { | 31 namespace chromeos { |
32 | 32 |
33 /////////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////////// |
34 // HelpApp, public: | 34 // HelpApp, public: |
35 | 35 |
36 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) | 36 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) |
37 : parent_window_(parent_window) { | 37 : parent_window_(parent_window) { |
38 } | 38 } |
39 | 39 |
40 void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { | 40 void HelpAppLauncher::ShowHelpTopic(HelpTopic help_topic_id) { |
41 Profile* profile = ProfileHelper::GetSigninProfile(); | 41 Profile* profile = ProfileHelper::GetSigninProfile(); |
42 ExtensionService* service = | 42 ExtensionRegistry* registry = ExtensionRegistry::Get(profile); |
43 extensions::ExtensionSystem::Get(profile)->extension_service(); | |
44 | 43 |
45 DCHECK(service); | 44 DCHECK(registry); |
46 if (!service) | 45 if (!registry) |
47 return; | 46 return; |
48 | 47 |
49 GURL url(base::StringPrintf(kHelpAppFormat, | 48 GURL url(base::StringPrintf(kHelpAppFormat, |
50 static_cast<int>(help_topic_id))); | 49 static_cast<int>(help_topic_id))); |
51 // HelpApp component extension presents only in official builds so we can | 50 // HelpApp component extension presents only in official builds so we can |
52 // show help only when the extensions is installed. | 51 // show help only when the extensions is installed. |
53 if (service->extensions()->GetByID(url.host())) | 52 if (registry->GetExtensionById(url.host(), ExtensionRegistry::ENABLED)) |
not at google - send to devlin
2014/11/11 20:20:08
Ditto.
Reilly Grant (use Gerrit)
2014/11/11 20:55:30
Done.
| |
54 ShowHelpTopicDialog(profile, GURL(url)); | 53 ShowHelpTopicDialog(profile, GURL(url)); |
55 } | 54 } |
56 | 55 |
57 /////////////////////////////////////////////////////////////////////////////// | 56 /////////////////////////////////////////////////////////////////////////////// |
58 // HelpApp, protected: | 57 // HelpApp, protected: |
59 | 58 |
60 HelpAppLauncher::~HelpAppLauncher() {} | 59 HelpAppLauncher::~HelpAppLauncher() {} |
61 | 60 |
62 /////////////////////////////////////////////////////////////////////////////// | 61 /////////////////////////////////////////////////////////////////////////////// |
63 // HelpApp, private: | 62 // HelpApp, private: |
(...skipping 10 matching lines...) Expand all Loading... | |
74 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 73 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
75 dialog->SetDialogSize(l10n_util::GetLocalizedContentsWidthInPixels( | 74 dialog->SetDialogSize(l10n_util::GetLocalizedContentsWidthInPixels( |
76 IDS_HELP_APP_DIALOG_WIDTH_PIXELS), | 75 IDS_HELP_APP_DIALOG_WIDTH_PIXELS), |
77 l10n_util::GetLocalizedContentsWidthInPixels( | 76 l10n_util::GetLocalizedContentsWidthInPixels( |
78 IDS_HELP_APP_DIALOG_HEIGHT_PIXELS)); | 77 IDS_HELP_APP_DIALOG_HEIGHT_PIXELS)); |
79 dialog->Show(); | 78 dialog->Show(); |
80 // The dialog object will be deleted on dialog close. | 79 // The dialog object will be deleted on dialog close. |
81 } | 80 } |
82 | 81 |
83 } // namespace chromeos | 82 } // namespace chromeos |
OLD | NEW |