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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 | 213 |
214 ExtensionWindowController* | 214 ExtensionWindowController* |
215 UIThreadExtensionFunction::GetExtensionWindowController() { | 215 UIThreadExtensionFunction::GetExtensionWindowController() { |
216 // If the delegate has an associated window controller, return it. | 216 // If the delegate has an associated window controller, return it. |
217 ExtensionWindowController* window_controller = | 217 ExtensionWindowController* window_controller = |
218 dispatcher()->delegate()->GetExtensionWindowController(); | 218 dispatcher()->delegate()->GetExtensionWindowController(); |
219 if (window_controller) | 219 if (window_controller) |
220 return window_controller; | 220 return window_controller; |
221 | 221 |
222 Profile* profile = Profile::FromBrowserContext( | 222 return ExtensionWindowList::GetInstance()->CurrentWindow(this); |
223 render_view_host_->GetProcess()->GetBrowserContext()); | |
224 ExtensionWindowList::ProfileMatchType match_type = include_incognito_ | |
225 ? ExtensionWindowController::MATCH_INCOGNITO | |
226 : ExtensionWindowController::MATCH_NORMAL_ONLY; | |
227 return ExtensionWindowList::GetInstance()->CurrentWindow(profile, match_type); | |
228 } | 223 } |
229 | 224 |
230 void UIThreadExtensionFunction::SendResponse(bool success) { | 225 void UIThreadExtensionFunction::SendResponse(bool success) { |
231 if (delegate_) { | 226 if (delegate_) { |
232 delegate_->OnSendResponse(this, success, bad_message_); | 227 delegate_->OnSendResponse(this, success, bad_message_); |
233 } else { | 228 } else { |
234 if (!render_view_host_ || !dispatcher()) | 229 if (!render_view_host_ || !dispatcher()) |
235 return; | 230 return; |
236 | 231 |
237 SendResponseImpl(render_view_host_->GetProcess()->GetHandle(), | 232 SendResponseImpl(render_view_host_->GetProcess()->GetHandle(), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 278 |
284 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 279 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
285 } | 280 } |
286 | 281 |
287 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 282 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
288 } | 283 } |
289 | 284 |
290 void SyncIOThreadExtensionFunction::Run() { | 285 void SyncIOThreadExtensionFunction::Run() { |
291 SendResponse(RunImpl()); | 286 SendResponse(RunImpl()); |
292 } | 287 } |
OLD | NEW |