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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (!window_getter_.is_null()) | 107 if (!window_getter_.is_null()) |
108 parent_window_ = window_getter_.Run(); | 108 parent_window_ = window_getter_.Run(); |
109 prompt_.reset(parent_contents_ ? | 109 prompt_.reset(parent_contents_ ? |
110 new ExtensionInstallPrompt(parent_contents_) : | 110 new ExtensionInstallPrompt(parent_contents_) : |
111 new ExtensionInstallPrompt(profile_, parent_window_, this)); | 111 new ExtensionInstallPrompt(profile_, parent_window_, this)); |
112 } | 112 } |
113 | 113 |
114 void ExtensionEnableFlow::StartObserving() { | 114 void ExtensionEnableFlow::StartObserving() { |
115 extension_registry_observer_.Add( | 115 extension_registry_observer_.Add( |
116 extensions::ExtensionRegistry::Get(profile_)); | 116 extensions::ExtensionRegistry::Get(profile_)); |
117 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, | 117 registrar_.Add(this, |
| 118 extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, |
118 content::Source<Profile>(profile_)); | 119 content::Source<Profile>(profile_)); |
119 } | 120 } |
120 | 121 |
121 void ExtensionEnableFlow::StopObserving() { | 122 void ExtensionEnableFlow::StopObserving() { |
122 registrar_.RemoveAll(); | 123 registrar_.RemoveAll(); |
123 extension_registry_observer_.RemoveAll(); | 124 extension_registry_observer_.RemoveAll(); |
124 } | 125 } |
125 | 126 |
126 void ExtensionEnableFlow::Observe(int type, | 127 void ExtensionEnableFlow::Observe(int type, |
127 const content::NotificationSource& source, | 128 const content::NotificationSource& source, |
128 const content::NotificationDetails& details) { | 129 const content::NotificationDetails& details) { |
129 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, type); | 130 DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_LOAD_ERROR, type); |
130 StopObserving(); | 131 StopObserving(); |
131 delegate_->ExtensionEnableFlowAborted(false); | 132 delegate_->ExtensionEnableFlowAborted(false); |
132 } | 133 } |
133 | 134 |
134 void ExtensionEnableFlow::OnExtensionLoaded( | 135 void ExtensionEnableFlow::OnExtensionLoaded( |
135 content::BrowserContext* browser_context, | 136 content::BrowserContext* browser_context, |
136 const Extension* extension) { | 137 const Extension* extension) { |
137 if (extension->id() == extension_id_) { | 138 if (extension->id() == extension_id_) { |
138 StopObserving(); | 139 StopObserving(); |
139 CheckPermissionAndMaybePromptUser(); | 140 CheckPermissionAndMaybePromptUser(); |
(...skipping 30 matching lines...) Expand all Loading... |
170 delegate_->ExtensionEnableFlowAborted(user_initiated); | 171 delegate_->ExtensionEnableFlowAborted(user_initiated); |
171 // |delegate_| may delete us. | 172 // |delegate_| may delete us. |
172 } | 173 } |
173 | 174 |
174 content::WebContents* ExtensionEnableFlow::OpenURL( | 175 content::WebContents* ExtensionEnableFlow::OpenURL( |
175 const content::OpenURLParams& params) { | 176 const content::OpenURLParams& params) { |
176 chrome::ScopedTabbedBrowserDisplayer displayer( | 177 chrome::ScopedTabbedBrowserDisplayer displayer( |
177 profile_, chrome::GetActiveDesktop()); | 178 profile_, chrome::GetActiveDesktop()); |
178 return displayer.browser()->OpenURL(params); | 179 return displayer.browser()->OpenURL(params); |
179 } | 180 } |
OLD | NEW |