| 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/ui/extensions/extension_enable_flow.h" | 5 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 57 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 58 const Extension* extension = service->GetExtensionById(extension_id_, true); | 58 const Extension* extension = service->GetExtensionById(extension_id_, true); |
| 59 if (!extension) { | 59 if (!extension) { |
| 60 extension = extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( | 60 extension = extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 61 extension_id_, extensions::ExtensionRegistry::TERMINATED); | 61 extension_id_, extensions::ExtensionRegistry::TERMINATED); |
| 62 // It's possible (though unlikely) the app could have been uninstalled since | 62 // It's possible (though unlikely) the app could have been uninstalled since |
| 63 // the user clicked on it. | 63 // the user clicked on it. |
| 64 if (!extension) | 64 if (!extension) |
| 65 return; | 65 return; |
| 66 // If the app was terminated, reload it first. | 66 // If the app was terminated, reload it first. |
| 67 service->ReloadExtension(extension_id_); | 67 service->ReloadExtension(extension_id_, true); |
| 68 | 68 |
| 69 // ReloadExtension reallocates the Extension object. | 69 // ReloadExtension reallocates the Extension object. |
| 70 extension = service->GetExtensionById(extension_id_, true); | 70 extension = service->GetExtensionById(extension_id_, true); |
| 71 | 71 |
| 72 // |extension| could be NULL for asynchronous load, such as the case of | 72 // |extension| could be NULL for asynchronous load, such as the case of |
| 73 // an unpacked extension. Wait for the load to continue the flow. | 73 // an unpacked extension. Wait for the load to continue the flow. |
| 74 if (!extension) { | 74 if (!extension) { |
| 75 StartObserving(); | 75 StartObserving(); |
| 76 return; | 76 return; |
| 77 } | 77 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 delegate_->ExtensionEnableFlowAborted(user_initiated); | 169 delegate_->ExtensionEnableFlowAborted(user_initiated); |
| 170 // |delegate_| may delete us. | 170 // |delegate_| may delete us. |
| 171 } | 171 } |
| 172 | 172 |
| 173 content::WebContents* ExtensionEnableFlow::OpenURL( | 173 content::WebContents* ExtensionEnableFlow::OpenURL( |
| 174 const content::OpenURLParams& params) { | 174 const content::OpenURLParams& params) { |
| 175 chrome::ScopedTabbedBrowserDisplayer displayer( | 175 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 176 profile_, chrome::GetActiveDesktop()); | 176 profile_, chrome::GetActiveDesktop()); |
| 177 return displayer.browser()->OpenURL(params); | 177 return displayer.browser()->OpenURL(params); |
| 178 } | 178 } |
| OLD | NEW |