OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 // If the delegate has an associated browser, that is always the right answer. | 485 // If the delegate has an associated browser, that is always the right answer. |
486 if (browser) | 486 if (browser) |
487 return browser; | 487 return browser; |
488 | 488 |
489 // Otherwise, try to default to a reasonable browser. If |include_incognito| | 489 // Otherwise, try to default to a reasonable browser. If |include_incognito| |
490 // is true, we will also search browsers in the incognito version of this | 490 // is true, we will also search browsers in the incognito version of this |
491 // profile. Note that the profile may already be incognito, in which case | 491 // profile. Note that the profile may already be incognito, in which case |
492 // we will search the incognito version only, regardless of the value of | 492 // we will search the incognito version only, regardless of the value of |
493 // |include_incognito|. | 493 // |include_incognito|. |
494 Profile* profile = render_view_host->process()->profile(); | 494 Profile* profile = Profile::FromBrowserContext( |
| 495 render_view_host->process()->browser_context()); |
495 browser = BrowserList::FindTabbedBrowser(profile, include_incognito); | 496 browser = BrowserList::FindTabbedBrowser(profile, include_incognito); |
496 | 497 |
497 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, | 498 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
498 // a background_page onload chrome.tabs api call can make it into here | 499 // a background_page onload chrome.tabs api call can make it into here |
499 // before the browser is sufficiently initialized to return here. | 500 // before the browser is sufficiently initialized to return here. |
500 // A similar situation may arise during shutdown. | 501 // A similar situation may arise during shutdown. |
501 // TODO(rafaelw): Delay creation of background_page until the browser | 502 // TODO(rafaelw): Delay creation of background_page until the browser |
502 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 | 503 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 |
503 return browser; | 504 return browser; |
504 } | 505 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 return function; | 606 return function; |
606 } | 607 } |
607 | 608 |
608 // static | 609 // static |
609 void ExtensionFunctionDispatcher::SendAccessDenied( | 610 void ExtensionFunctionDispatcher::SendAccessDenied( |
610 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { | 611 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
611 ipc_sender->Send(new ExtensionMsg_Response( | 612 ipc_sender->Send(new ExtensionMsg_Response( |
612 routing_id, request_id, false, std::string(), | 613 routing_id, request_id, false, std::string(), |
613 "Access to extension API denied.")); | 614 "Access to extension API denied.")); |
614 } | 615 } |
OLD | NEW |