Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc

Issue 1659203002: Remove HostDesktopType from FindLastActive[WithProfile] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nullptr Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 base::Bind(callback, UpdateCheckResult(true, kUpdateThrottled, ""))); 162 base::Bind(callback, UpdateCheckResult(true, kUpdateThrottled, "")));
163 } else { 163 } else {
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 = 172 Browser* browser = chrome::FindLastActiveWithProfile(profile);
173 chrome::FindLastActiveWithProfile(profile, chrome::GetActiveDesktop());
174 if (!browser) 173 if (!browser)
175 browser = 174 browser =
176 new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop())); 175 new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop()));
177 176
178 chrome::NavigateParams params( 177 chrome::NavigateParams params(
179 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT); 178 browser, uninstall_url, ui::PAGE_TRANSITION_CLIENT_REDIRECT);
180 params.disposition = NEW_FOREGROUND_TAB; 179 params.disposition = NEW_FOREGROUND_TAB;
181 params.user_gesture = false; 180 params.user_gesture = false;
182 chrome::Navigate(&params); 181 chrome::Navigate(&params);
183 } 182 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 ->RequestRestart(); 233 ->RequestRestart();
235 return true; 234 return true;
236 } 235 }
237 #endif 236 #endif
238 *error_message = "Function available only for ChromeOS kiosk mode."; 237 *error_message = "Function available only for ChromeOS kiosk mode.";
239 return false; 238 return false;
240 } 239 }
241 240
242 bool ChromeRuntimeAPIDelegate::OpenOptionsPage(const Extension* extension) { 241 bool ChromeRuntimeAPIDelegate::OpenOptionsPage(const Extension* extension) {
243 Profile* profile = Profile::FromBrowserContext(browser_context_); 242 Profile* profile = Profile::FromBrowserContext(browser_context_);
244 Browser* browser = 243 Browser* browser = chrome::FindLastActiveWithProfile(profile);
245 chrome::FindLastActiveWithProfile(profile, chrome::GetActiveDesktop());
246 if (!browser) 244 if (!browser)
247 return false; 245 return false;
248 return extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser); 246 return extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser);
249 } 247 }
250 248
251 void ChromeRuntimeAPIDelegate::Observe( 249 void ChromeRuntimeAPIDelegate::Observe(
252 int type, 250 int type,
253 const content::NotificationSource& source, 251 const content::NotificationSource& source,
254 const content::NotificationDetails& details) { 252 const content::NotificationDetails& details) {
255 DCHECK(type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND); 253 DCHECK(type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND);
(...skipping 26 matching lines...) Expand all
282 const UpdateCheckResult& result) { 280 const UpdateCheckResult& result) {
283 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; 281 UpdateCallbackList callbacks = pending_update_checks_[extension_id];
284 pending_update_checks_.erase(extension_id); 282 pending_update_checks_.erase(extension_id);
285 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); 283 for (UpdateCallbackList::const_iterator iter = callbacks.begin();
286 iter != callbacks.end(); 284 iter != callbacks.end();
287 ++iter) { 285 ++iter) {
288 const UpdateCheckCallback& callback = *iter; 286 const UpdateCheckCallback& callback = *iter;
289 callback.Run(result); 287 callback.Run(result);
290 } 288 }
291 } 289 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/extension_action/extension_action_api.cc ('k') | chrome/browser/extensions/bundle_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698