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/extensions/extension_tab_helper.h" | 5 #include "chrome/browser/extensions/extension_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/webstore_inline_installer.h" | 8 #include "chrome/browser/extensions/webstore_inline_installer.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sessions/restore_tab_helper.h" | 10 #include "chrome/browser/sessions/restore_tab_helper.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 extension_app_ = extension; | 57 extension_app_ = extension; |
58 | 58 |
59 UpdateExtensionAppIcon(extension_app_); | 59 UpdateExtensionAppIcon(extension_app_); |
60 | 60 |
61 content::NotificationService::current()->Notify( | 61 content::NotificationService::current()->Notify( |
62 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, | 62 chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, |
63 content::Source<ExtensionTabHelper>(this), | 63 content::Source<ExtensionTabHelper>(this), |
64 content::NotificationService::NoDetails()); | 64 content::NotificationService::NoDetails()); |
65 } | 65 } |
66 | 66 |
67 void ExtensionTabHelper::SetExtensionAppById( | 67 const Extension* ExtensionTabHelper::GetExtension( |
sky
2012/03/05 15:20:25
Make order match header.
stevenjb
2012/03/05 19:50:06
Done.
| |
68 const std::string& extension_app_id) { | 68 const std::string& extension_app_id) { |
69 if (extension_app_id.empty()) | 69 if (extension_app_id.empty()) |
70 return; | 70 return NULL; |
71 | 71 |
72 Profile* profile = | 72 Profile* profile = |
73 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 73 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
74 ExtensionService* extension_service = profile->GetExtensionService(); | 74 ExtensionService* extension_service = profile->GetExtensionService(); |
75 if (!extension_service || !extension_service->is_ready()) | 75 if (!extension_service || !extension_service->is_ready()) |
76 return; | 76 return NULL; |
77 | 77 |
78 const Extension* extension = | 78 const Extension* extension = |
79 extension_service->GetExtensionById(extension_app_id, false); | 79 extension_service->GetExtensionById(extension_app_id, false); |
80 return extension; | |
81 } | |
82 | |
83 void ExtensionTabHelper::SetExtensionAppById( | |
84 const std::string& extension_app_id) { | |
85 const Extension* extension = GetExtension(extension_app_id); | |
80 if (extension) | 86 if (extension) |
81 SetExtensionApp(extension); | 87 SetExtensionApp(extension); |
82 } | 88 } |
83 | 89 |
90 void ExtensionTabHelper::SetExtensionAppIconById( | |
91 const std::string& extension_app_id) { | |
92 const Extension* extension = GetExtension(extension_app_id); | |
93 if (extension) | |
94 UpdateExtensionAppIcon(extension); | |
95 } | |
96 | |
84 SkBitmap* ExtensionTabHelper::GetExtensionAppIcon() { | 97 SkBitmap* ExtensionTabHelper::GetExtensionAppIcon() { |
85 if (extension_app_icon_.empty()) | 98 if (extension_app_icon_.empty()) |
86 return NULL; | 99 return NULL; |
87 | 100 |
88 return &extension_app_icon_; | 101 return &extension_app_icon_; |
89 } | 102 } |
90 | 103 |
91 void ExtensionTabHelper::DidNavigateMainFrame( | 104 void ExtensionTabHelper::DidNavigateMainFrame( |
92 const content::LoadCommittedDetails& details, | 105 const content::LoadCommittedDetails& details, |
93 const content::FrameNavigateParams& params) { | 106 const content::FrameNavigateParams& params) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, | 298 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, |
286 int return_route_id, | 299 int return_route_id, |
287 const std::string& error) { | 300 const std::string& error) { |
288 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 301 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
289 return_route_id, install_id, false, error)); | 302 return_route_id, install_id, false, error)); |
290 } | 303 } |
291 | 304 |
292 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { | 305 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { |
293 return web_contents(); | 306 return web_contents(); |
294 } | 307 } |
OLD | NEW |