| 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" |
| 11 #include "chrome/browser/extensions/extension_window_controller.h" | 11 #include "chrome/browser/extensions/extension_window_controller.h" |
| 12 #include "chrome/browser/extensions/extension_window_list.h" | 12 #include "chrome/browser/extensions/extension_window_list.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 14 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 15 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/common/extensions/extension_messages.h" | 16 #include "chrome/common/extensions/extension_messages.h" |
| 17 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 18 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 19 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/user_metrics.h" | 21 #include "content/public/browser/user_metrics.h" |
| 22 #include "content/public/common/result_codes.h" | 22 #include "content/public/common/result_codes.h" |
| 23 | 23 |
| 24 using content::BrowserThread; | 24 using content::BrowserThread; |
| 25 using content::RenderViewHost; | 25 using content::RenderViewHost; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return browser; | 193 return browser; |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Otherwise, try to default to a reasonable browser. If |include_incognito_| | 196 // Otherwise, try to default to a reasonable browser. If |include_incognito_| |
| 197 // is true, we will also search browsers in the incognito version of this | 197 // is true, we will also search browsers in the incognito version of this |
| 198 // profile. Note that the profile may already be incognito, in which case | 198 // profile. Note that the profile may already be incognito, in which case |
| 199 // we will search the incognito version only, regardless of the value of | 199 // we will search the incognito version only, regardless of the value of |
| 200 // |include_incognito|. | 200 // |include_incognito|. |
| 201 Profile* profile = Profile::FromBrowserContext( | 201 Profile* profile = Profile::FromBrowserContext( |
| 202 render_view_host_->GetProcess()->GetBrowserContext()); | 202 render_view_host_->GetProcess()->GetBrowserContext()); |
| 203 Browser* browser = BrowserList::FindAnyBrowser(profile, include_incognito_); | 203 Browser* browser = browser::FindAnyBrowser(profile, include_incognito_); |
| 204 | 204 |
| 205 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, | 205 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
| 206 // a background_page onload chrome.tabs api call can make it into here | 206 // a background_page onload chrome.tabs api call can make it into here |
| 207 // before the browser is sufficiently initialized to return here. | 207 // before the browser is sufficiently initialized to return here. |
| 208 // A similar situation may arise during shutdown. | 208 // A similar situation may arise during shutdown. |
| 209 // TODO(rafaelw): Delay creation of background_page until the browser | 209 // TODO(rafaelw): Delay creation of background_page until the browser |
| 210 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 | 210 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 |
| 211 return browser; | 211 return browser; |
| 212 } | 212 } |
| 213 | 213 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 284 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
| 285 } | 285 } |
| 286 | 286 |
| 287 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 287 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
| 288 } | 288 } |
| 289 | 289 |
| 290 void SyncIOThreadExtensionFunction::Run() { | 290 void SyncIOThreadExtensionFunction::Run() { |
| 291 SendResponse(RunImpl()); | 291 SendResponse(RunImpl()); |
| 292 } | 292 } |
| OLD | NEW |