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_processes_api.h" | 5 #include "chrome/browser/extensions/extension_processes_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 | 14 |
| 15 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
15 #include "chrome/browser/extensions/extension_event_router.h" | 16 #include "chrome/browser/extensions/extension_event_router.h" |
16 #include "chrome/browser/extensions/extension_function_util.h" | 17 #include "chrome/browser/extensions/extension_function_util.h" |
17 #include "chrome/browser/extensions/extension_processes_api_constants.h" | 18 #include "chrome/browser/extensions/extension_processes_api_constants.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/extensions/extension_tab_util.h" | 20 #include "chrome/browser/extensions/extension_tab_util.h" |
20 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/task_manager/task_manager.h" | 22 #include "chrome/browser/task_manager/task_manager.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/extensions/extension_error_utils.h" | 25 #include "chrome/common/extensions/extension_error_utils.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 registrar_.RemoveAll(); | 560 registrar_.RemoveAll(); |
561 GetProcessIdForTab(); | 561 GetProcessIdForTab(); |
562 } | 562 } |
563 | 563 |
564 void GetProcessIdForTabFunction::GetProcessIdForTab() { | 564 void GetProcessIdForTabFunction::GetProcessIdForTab() { |
565 TabContentsWrapper* contents = NULL; | 565 TabContentsWrapper* contents = NULL; |
566 int tab_index = -1; | 566 int tab_index = -1; |
567 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), | 567 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), |
568 NULL, NULL, &contents, &tab_index)) { | 568 NULL, NULL, &contents, &tab_index)) { |
569 error_ = ExtensionErrorUtils::FormatErrorMessage( | 569 error_ = ExtensionErrorUtils::FormatErrorMessage( |
570 extension_tabs_module_constants::kTabNotFoundError, | 570 extensions::tabs_constants::kTabNotFoundError, |
571 base::IntToString(tab_id_)); | 571 base::IntToString(tab_id_)); |
572 result_.reset(Value::CreateIntegerValue(-1)); | 572 result_.reset(Value::CreateIntegerValue(-1)); |
573 SendResponse(false); | 573 SendResponse(false); |
574 } else { | 574 } else { |
575 int process_id = contents->web_contents()->GetRenderProcessHost()->GetID(); | 575 int process_id = contents->web_contents()->GetRenderProcessHost()->GetID(); |
576 result_.reset(Value::CreateIntegerValue(process_id)); | 576 result_.reset(Value::CreateIntegerValue(process_id)); |
577 SendResponse(true); | 577 SendResponse(true); |
578 } | 578 } |
579 | 579 |
580 // Balance the AddRef in the RunImpl. | 580 // Balance the AddRef in the RunImpl. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 745 } |
746 DCHECK(process_ids_.size() == 0); | 746 DCHECK(process_ids_.size() == 0); |
747 } | 747 } |
748 | 748 |
749 result_.reset(processes); | 749 result_.reset(processes); |
750 SendResponse(true); | 750 SendResponse(true); |
751 | 751 |
752 // Balance the AddRef in the RunImpl. | 752 // Balance the AddRef in the RunImpl. |
753 Release(); | 753 Release(); |
754 } | 754 } |
OLD | NEW |