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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 // If the delegate has an associated browser, that is always the right answer. | 479 // If the delegate has an associated browser, that is always the right answer. |
480 if (browser) | 480 if (browser) |
481 return browser; | 481 return browser; |
482 | 482 |
483 // Otherwise, try to default to a reasonable browser. If |include_incognito| | 483 // Otherwise, try to default to a reasonable browser. If |include_incognito| |
484 // is true, we will also search browsers in the incognito version of this | 484 // is true, we will also search browsers in the incognito version of this |
485 // profile. Note that the profile may already be incognito, in which case | 485 // profile. Note that the profile may already be incognito, in which case |
486 // we will search the incognito version only, regardless of the value of | 486 // we will search the incognito version only, regardless of the value of |
487 // |include_incognito|. | 487 // |include_incognito|. |
488 Profile* profile = render_view_host->process()->profile(); | 488 Profile* profile = |
| 489 static_cast<Profile*>(render_view_host->process()->context()); |
489 browser = BrowserList::FindTabbedBrowser(profile, include_incognito); | 490 browser = BrowserList::FindTabbedBrowser(profile, include_incognito); |
490 | 491 |
491 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, | 492 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
492 // a background_page onload chrome.tabs api call can make it into here | 493 // a background_page onload chrome.tabs api call can make it into here |
493 // before the browser is sufficiently initialized to return here. | 494 // before the browser is sufficiently initialized to return here. |
494 // A similar situation may arise during shutdown. | 495 // A similar situation may arise during shutdown. |
495 // TODO(rafaelw): Delay creation of background_page until the browser | 496 // TODO(rafaelw): Delay creation of background_page until the browser |
496 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 | 497 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 |
497 return browser; | 498 return browser; |
498 } | 499 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 return function; | 600 return function; |
600 } | 601 } |
601 | 602 |
602 // static | 603 // static |
603 void ExtensionFunctionDispatcher::SendAccessDenied( | 604 void ExtensionFunctionDispatcher::SendAccessDenied( |
604 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { | 605 IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
605 ipc_sender->Send(new ExtensionMsg_Response( | 606 ipc_sender->Send(new ExtensionMsg_Response( |
606 routing_id, request_id, false, std::string(), | 607 routing_id, request_id, false, std::string(), |
607 "Access to extension API denied.")); | 608 "Access to extension API denied.")); |
608 } | 609 } |
OLD | NEW |