OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/api/runtime/chrome_runtime_api_delegate.h" | 5 #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 UpdateCallbackList& callbacks = pending_update_checks_[extension_id]; | 164 UpdateCallbackList& callbacks = pending_update_checks_[extension_id]; |
165 callbacks.push_back(callback); | 165 callbacks.push_back(callback); |
166 } | 166 } |
167 return true; | 167 return true; |
168 } | 168 } |
169 | 169 |
170 void ChromeRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { | 170 void ChromeRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { |
171 Profile* profile = Profile::FromBrowserContext(browser_context_); | 171 Profile* profile = Profile::FromBrowserContext(browser_context_); |
172 Browser* browser = chrome::FindLastActiveWithProfile(profile); | 172 Browser* browser = chrome::FindLastActiveWithProfile(profile); |
173 if (!browser) | 173 if (!browser) |
174 browser = | 174 browser = new Browser(Browser::CreateParams(profile)); |
175 new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop())); | |
176 | 175 |
177 chrome::NavigateParams params( | 176 chrome::NavigateParams params( |
178 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); | 177 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
179 params.disposition = NEW_FOREGROUND_TAB; | 178 params.disposition = NEW_FOREGROUND_TAB; |
180 params.user_gesture = false; | 179 params.user_gesture = false; |
181 chrome::Navigate(¶ms); | 180 chrome::Navigate(¶ms); |
182 } | 181 } |
183 | 182 |
184 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { | 183 bool ChromeRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { |
185 const char* os = update_client::UpdateQueryParams::GetOS(); | 184 const char* os = update_client::UpdateQueryParams::GetOS(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 const UpdateCheckResult& result) { | 279 const UpdateCheckResult& result) { |
281 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 280 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
282 pending_update_checks_.erase(extension_id); | 281 pending_update_checks_.erase(extension_id); |
283 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 282 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
284 iter != callbacks.end(); | 283 iter != callbacks.end(); |
285 ++iter) { | 284 ++iter) { |
286 const UpdateCheckCallback& callback = *iter; | 285 const UpdateCheckCallback& callback = *iter; |
287 callback.Run(result); | 286 callback.Run(result); |
288 } | 287 } |
289 } | 288 } |
OLD | NEW |