Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/browser/extensions/extension_processes_api.cc

Issue 10535077: TabContentsWrapper -> TabContents, part 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/api/tabs/tabs_constants.h"
16 #include "chrome/browser/extensions/extension_event_router.h" 16 #include "chrome/browser/extensions/extension_event_router.h"
17 #include "chrome/browser/extensions/extension_function_util.h" 17 #include "chrome/browser/extensions/extension_function_util.h"
18 #include "chrome/browser/extensions/extension_processes_api_constants.h" 18 #include "chrome/browser/extensions/extension_processes_api_constants.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_tab_util.h" 20 #include "chrome/browser/extensions/extension_tab_util.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.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"
31 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/render_view_host.h" 32 #include "content/public/browser/render_view_host.h"
33 #include "content/public/browser/render_widget_host.h" 33 #include "content/public/browser/render_widget_host.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 void GetProcessIdForTabFunction::Observe( 555 void GetProcessIdForTabFunction::Observe(
556 int type, 556 int type,
557 const content::NotificationSource& source, 557 const content::NotificationSource& source,
558 const content::NotificationDetails& details) { 558 const content::NotificationDetails& details) {
559 DCHECK_EQ(type, chrome::NOTIFICATION_TASK_MANAGER_CHILD_PROCESSES_DATA_READY); 559 DCHECK_EQ(type, chrome::NOTIFICATION_TASK_MANAGER_CHILD_PROCESSES_DATA_READY);
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 TabContents* 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 extensions::tabs_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();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698