| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 // If the delegate has an associated browser, that is always the right answer. | 492 // If the delegate has an associated browser, that is always the right answer. |
| 493 if (browser) | 493 if (browser) |
| 494 return browser; | 494 return browser; |
| 495 | 495 |
| 496 // Otherwise, try to default to a reasonable browser. If |include_incognito| | 496 // Otherwise, try to default to a reasonable browser. If |include_incognito| |
| 497 // is true, we will also search browsers in the incognito version of this | 497 // is true, we will also search browsers in the incognito version of this |
| 498 // profile. Note that the profile may already be incognito, in which case | 498 // profile. Note that the profile may already be incognito, in which case |
| 499 // we will search the incognito version only, regardless of the value of | 499 // we will search the incognito version only, regardless of the value of |
| 500 // |include_incognito|. | 500 // |include_incognito|. |
| 501 Profile* profile = Profile::FromBrowserContext( | 501 Profile* profile = render_view_host->process()->profile(); |
| 502 render_view_host->process()->browser_context()); | |
| 503 browser = BrowserList::FindTabbedBrowser(profile, include_incognito); | 502 browser = BrowserList::FindTabbedBrowser(profile, include_incognito); |
| 504 | 503 |
| 505 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, | 504 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
| 506 // a background_page onload chrome.tabs api call can make it into here | 505 // a background_page onload chrome.tabs api call can make it into here |
| 507 // before the browser is sufficiently initialized to return here. | 506 // before the browser is sufficiently initialized to return here. |
| 508 // A similar situation may arise during shutdown. | 507 // A similar situation may arise during shutdown. |
| 509 // TODO(rafaelw): Delay creation of background_page until the browser | 508 // TODO(rafaelw): Delay creation of background_page until the browser |
| 510 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 | 509 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 |
| 511 return browser; | 510 return browser; |
| 512 } | 511 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 return function; | 612 return function; |
| 614 } | 613 } |
| 615 | 614 |
| 616 // static | 615 // static |
| 617 void ExtensionFunctionDispatcher::SendAccessDenied( | 616 void ExtensionFunctionDispatcher::SendAccessDenied( |
| 618 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { | 617 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
| 619 ipc_sender->Send(new ExtensionMsg_Response( | 618 ipc_sender->Send(new ExtensionMsg_Response( |
| 620 routing_id, request_id, false, std::string(), | 619 routing_id, request_id, false, std::string(), |
| 621 "Access to extension API denied.")); | 620 "Access to extension API denied.")); |
| 622 } | 621 } |
| OLD | NEW |