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/extensions/extension_function.h" | 5 #include "chrome/browser/extensions/extension_function.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Otherwise, try to default to a reasonable browser. If |include_incognito_| | 207 // Otherwise, try to default to a reasonable browser. If |include_incognito_| |
208 // is true, we will also search browsers in the incognito version of this | 208 // is true, we will also search browsers in the incognito version of this |
209 // profile. Note that the profile may already be incognito, in which case | 209 // profile. Note that the profile may already be incognito, in which case |
210 // we will search the incognito version only, regardless of the value of | 210 // we will search the incognito version only, regardless of the value of |
211 // |include_incognito|. Look only for browsers on the active desktop as it is | 211 // |include_incognito|. Look only for browsers on the active desktop as it is |
212 // preferable to pretend no browser is open then to return a browser on | 212 // preferable to pretend no browser is open then to return a browser on |
213 // another desktop. | 213 // another desktop. |
214 if (render_view_host_) { | 214 if (render_view_host_) { |
215 Profile* profile = Profile::FromBrowserContext( | 215 Profile* profile = Profile::FromBrowserContext( |
216 render_view_host_->GetProcess()->GetBrowserContext()); | 216 render_view_host_->GetProcess()->GetBrowserContext()); |
217 Browser* browser = browser::FindAnyBrowser(profile, include_incognito_, | 217 Browser* browser = chrome::FindAnyBrowser(profile, include_incognito_, |
218 chrome::GetActiveDesktop()); | 218 chrome::GetActiveDesktop()); |
219 if (browser) | 219 if (browser) |
220 return browser; | 220 return browser; |
221 } | 221 } |
222 | 222 |
223 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, | 223 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
224 // a background_page onload chrome.tabs api call can make it into here | 224 // a background_page onload chrome.tabs api call can make it into here |
225 // before the browser is sufficiently initialized to return here, or | 225 // before the browser is sufficiently initialized to return here, or |
226 // all of this profile's browser windows may have been closed. | 226 // all of this profile's browser windows may have been closed. |
227 // A similar situation may arise during shutdown. | 227 // A similar situation may arise during shutdown. |
228 // TODO(rafaelw): Delay creation of background_page until the browser | 228 // TODO(rafaelw): Delay creation of background_page until the browser |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 332 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
333 } | 333 } |
334 | 334 |
335 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 335 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
336 } | 336 } |
337 | 337 |
338 void SyncIOThreadExtensionFunction::Run() { | 338 void SyncIOThreadExtensionFunction::Run() { |
339 SendResponse(RunImpl()); | 339 SendResponse(RunImpl()); |
340 } | 340 } |
OLD | NEW |