| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/extensions/extension_page_actions_module.h" | 37 #include "chrome/browser/extensions/extension_page_actions_module.h" |
| 38 #include "chrome/browser/extensions/extension_page_actions_module_constants.h" | 38 #include "chrome/browser/extensions/extension_page_actions_module_constants.h" |
| 39 #include "chrome/browser/extensions/extension_popup_api.h" | 39 #include "chrome/browser/extensions/extension_popup_api.h" |
| 40 #include "chrome/browser/extensions/extension_process_manager.h" | 40 #include "chrome/browser/extensions/extension_process_manager.h" |
| 41 #include "chrome/browser/extensions/extension_processes_api.h" | 41 #include "chrome/browser/extensions/extension_processes_api.h" |
| 42 #include "chrome/browser/extensions/extension_proxy_api.h" | 42 #include "chrome/browser/extensions/extension_proxy_api.h" |
| 43 #include "chrome/browser/extensions/extension_rlz_module.h" | 43 #include "chrome/browser/extensions/extension_rlz_module.h" |
| 44 #include "chrome/browser/extensions/extension_tabs_module.h" | 44 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 45 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 45 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
| 46 #include "chrome/browser/extensions/extension_test_api.h" | 46 #include "chrome/browser/extensions/extension_test_api.h" |
| 47 #include "chrome/browser/extensions/extension_toolstrip_api.h" | |
| 48 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 49 #include "chrome/browser/extensions/extension_tts_api.h" | 48 #include "chrome/browser/extensions/extension_tts_api.h" |
| 50 #endif | 49 #endif |
| 51 #include "chrome/browser/extensions/extensions_quota_service.h" | 50 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 52 #include "chrome/browser/extensions/extensions_service.h" | 51 #include "chrome/browser/extensions/extensions_service.h" |
| 53 #include "chrome/browser/profile.h" | 52 #include "chrome/browser/profile.h" |
| 54 #include "chrome/browser/renderer_host/render_process_host.h" | 53 #include "chrome/browser/renderer_host/render_process_host.h" |
| 55 #include "chrome/browser/renderer_host/render_view_host.h" | 54 #include "chrome/browser/renderer_host/render_view_host.h" |
| 56 #include "chrome/common/render_messages.h" | 55 #include "chrome/common/render_messages.h" |
| 57 #include "chrome/common/result_codes.h" | 56 #include "chrome/common/result_codes.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 RegisterFunction<AddUrlHistoryFunction>(); | 175 RegisterFunction<AddUrlHistoryFunction>(); |
| 177 RegisterFunction<DeleteAllHistoryFunction>(); | 176 RegisterFunction<DeleteAllHistoryFunction>(); |
| 178 RegisterFunction<DeleteRangeHistoryFunction>(); | 177 RegisterFunction<DeleteRangeHistoryFunction>(); |
| 179 RegisterFunction<DeleteUrlHistoryFunction>(); | 178 RegisterFunction<DeleteUrlHistoryFunction>(); |
| 180 RegisterFunction<GetVisitsHistoryFunction>(); | 179 RegisterFunction<GetVisitsHistoryFunction>(); |
| 181 RegisterFunction<SearchHistoryFunction>(); | 180 RegisterFunction<SearchHistoryFunction>(); |
| 182 | 181 |
| 183 // Idle | 182 // Idle |
| 184 RegisterFunction<ExtensionIdleQueryStateFunction>(); | 183 RegisterFunction<ExtensionIdleQueryStateFunction>(); |
| 185 | 184 |
| 186 // Toolstrips. | |
| 187 RegisterFunction<ToolstripExpandFunction>(); | |
| 188 RegisterFunction<ToolstripCollapseFunction>(); | |
| 189 | |
| 190 // I18N. | 185 // I18N. |
| 191 RegisterFunction<GetAcceptLanguagesFunction>(); | 186 RegisterFunction<GetAcceptLanguagesFunction>(); |
| 192 | 187 |
| 193 // Popup API. | 188 // Popup API. |
| 194 RegisterFunction<PopupShowFunction>(); | 189 RegisterFunction<PopupShowFunction>(); |
| 195 | 190 |
| 196 // Processes. | 191 // Processes. |
| 197 RegisterFunction<GetProcessForTabFunction>(); | 192 RegisterFunction<GetProcessForTabFunction>(); |
| 198 | 193 |
| 199 // Metrics. | 194 // Metrics. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 Profile* profile = render_view_host()->process()->profile(); | 388 Profile* profile = render_view_host()->process()->profile(); |
| 394 | 389 |
| 395 // Make sure we don't return an incognito browser without proper access. | 390 // Make sure we don't return an incognito browser without proper access. |
| 396 if (!include_incognito) | 391 if (!include_incognito) |
| 397 profile = profile->GetOriginalProfile(); | 392 profile = profile->GetOriginalProfile(); |
| 398 | 393 |
| 399 browser = BrowserList::FindBrowserWithType(profile, Browser::TYPE_ANY, | 394 browser = BrowserList::FindBrowserWithType(profile, Browser::TYPE_ANY, |
| 400 include_incognito); | 395 include_incognito); |
| 401 | 396 |
| 402 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, | 397 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
| 403 // a toolstrip or background_page onload chrome.tabs api call can make it | 398 // a background_page onload chrome.tabs api call can make it into here |
| 404 // into here before the browser is sufficiently initialized to return here. | 399 // before the browser is sufficiently initialized to return here. |
| 405 // A similar situation may arise during shutdown. | 400 // A similar situation may arise during shutdown. |
| 406 // TODO(rafaelw): Delay creation of background_page until the browser | 401 // TODO(rafaelw): Delay creation of background_page until the browser |
| 407 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 | 402 // is available. http://code.google.com/p/chromium/issues/detail?id=13284 |
| 408 return browser; | 403 return browser; |
| 409 } | 404 } |
| 410 | 405 |
| 411 void ExtensionFunctionDispatcher::HandleRequest(const std::string& name, | 406 void ExtensionFunctionDispatcher::HandleRequest(const std::string& name, |
| 412 const ListValue* args, | 407 const ListValue* args, |
| 413 const GURL& source_url, | 408 const GURL& source_url, |
| 414 int request_id, | 409 int request_id, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } else { | 451 } else { |
| 457 NOTREACHED(); | 452 NOTREACHED(); |
| 458 base::KillProcess(render_view_host_->process()->GetHandle(), | 453 base::KillProcess(render_view_host_->process()->GetHandle(), |
| 459 ResultCodes::KILLED_BAD_MESSAGE, false); | 454 ResultCodes::KILLED_BAD_MESSAGE, false); |
| 460 } | 455 } |
| 461 } | 456 } |
| 462 | 457 |
| 463 Profile* ExtensionFunctionDispatcher::profile() { | 458 Profile* ExtensionFunctionDispatcher::profile() { |
| 464 return profile_; | 459 return profile_; |
| 465 } | 460 } |
| OLD | NEW |