| 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" | |
| 11 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 10 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
| 12 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | |
| 13 #include "content/public/browser/notification_details.h" | 11 #include "content/public/browser/notification_details.h" |
| 14 #include "content/public/browser/notification_source.h" | 12 #include "content/public/browser/notification_source.h" |
| 15 #include "extensions/browser/extension_prefs.h" | 13 #include "extensions/browser/extension_prefs.h" |
| 16 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
| 17 #include "extensions/browser/extension_system.h" | 15 #include "extensions/browser/extension_system.h" |
| 18 | 16 |
| 19 using extensions::Extension; | 17 using extensions::Extension; |
| 20 | 18 |
| 21 ExtensionEnableFlow::ExtensionEnableFlow(Profile* profile, | 19 ExtensionEnableFlow::ExtensionEnableFlow(Profile* profile, |
| 22 const std::string& extension_id, | 20 const std::string& extension_id, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 99 |
| 102 CreatePrompt(); | 100 CreatePrompt(); |
| 103 prompt_->ConfirmReEnable(this, extension); | 101 prompt_->ConfirmReEnable(this, extension); |
| 104 } | 102 } |
| 105 | 103 |
| 106 void ExtensionEnableFlow::CreatePrompt() { | 104 void ExtensionEnableFlow::CreatePrompt() { |
| 107 if (!window_getter_.is_null()) | 105 if (!window_getter_.is_null()) |
| 108 parent_window_ = window_getter_.Run(); | 106 parent_window_ = window_getter_.Run(); |
| 109 prompt_.reset(parent_contents_ ? | 107 prompt_.reset(parent_contents_ ? |
| 110 new ExtensionInstallPrompt(parent_contents_) : | 108 new ExtensionInstallPrompt(parent_contents_) : |
| 111 new ExtensionInstallPrompt(profile_, parent_window_, this)); | 109 new ExtensionInstallPrompt(profile_, parent_window_)); |
| 112 } | 110 } |
| 113 | 111 |
| 114 void ExtensionEnableFlow::StartObserving() { | 112 void ExtensionEnableFlow::StartObserving() { |
| 115 extension_registry_observer_.Add( | 113 extension_registry_observer_.Add( |
| 116 extensions::ExtensionRegistry::Get(profile_)); | 114 extensions::ExtensionRegistry::Get(profile_)); |
| 117 registrar_.Add(this, | 115 registrar_.Add(this, |
| 118 extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, | 116 extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, |
| 119 content::Source<Profile>(profile_)); | 117 content::Source<Profile>(profile_)); |
| 120 } | 118 } |
| 121 | 119 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 162 } |
| 165 | 163 |
| 166 service->GrantPermissionsAndEnableExtension(extension); | 164 service->GrantPermissionsAndEnableExtension(extension); |
| 167 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. | 165 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. |
| 168 } | 166 } |
| 169 | 167 |
| 170 void ExtensionEnableFlow::InstallUIAbort(bool user_initiated) { | 168 void ExtensionEnableFlow::InstallUIAbort(bool user_initiated) { |
| 171 delegate_->ExtensionEnableFlowAborted(user_initiated); | 169 delegate_->ExtensionEnableFlowAborted(user_initiated); |
| 172 // |delegate_| may delete us. | 170 // |delegate_| may delete us. |
| 173 } | 171 } |
| 174 | |
| 175 content::WebContents* ExtensionEnableFlow::OpenURL( | |
| 176 const content::OpenURLParams& params) { | |
| 177 chrome::ScopedTabbedBrowserDisplayer displayer( | |
| 178 profile_, chrome::GetActiveDesktop()); | |
| 179 return displayer.browser()->OpenURL(params); | |
| 180 } | |
| OLD | NEW |