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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 9150017: Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix?! Created 8 years, 11 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
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #include "chrome/common/chrome_view_type.h" 110 #include "chrome/common/chrome_view_type.h"
111 #include "chrome/common/extensions/extension.h" 111 #include "chrome/common/extensions/extension.h"
112 #include "chrome/common/extensions/extension_action.h" 112 #include "chrome/common/extensions/extension_action.h"
113 #include "chrome/common/extensions/url_pattern.h" 113 #include "chrome/common/extensions/url_pattern.h"
114 #include "chrome/common/extensions/url_pattern_set.h" 114 #include "chrome/common/extensions/url_pattern_set.h"
115 #include "chrome/common/pref_names.h" 115 #include "chrome/common/pref_names.h"
116 #include "chrome/common/render_messages.h" 116 #include "chrome/common/render_messages.h"
117 #include "chrome/common/url_constants.h" 117 #include "chrome/common/url_constants.h"
118 #include "content/browser/renderer_host/render_view_host.h" 118 #include "content/browser/renderer_host/render_view_host.h"
119 #include "content/browser/tab_contents/interstitial_page.h" 119 #include "content/browser/tab_contents/interstitial_page.h"
120 #include "content/public/browser/browser_child_process_host_iterator.h"
121 #include "content/public/browser/child_process_data.h"
120 #include "content/public/browser/favicon_status.h" 122 #include "content/public/browser/favicon_status.h"
121 #include "content/public/browser/navigation_entry.h" 123 #include "content/public/browser/navigation_entry.h"
122 #include "content/public/browser/notification_service.h" 124 #include "content/public/browser/notification_service.h"
123 #include "content/public/browser/plugin_service.h" 125 #include "content/public/browser/plugin_service.h"
124 #include "content/public/browser/render_process_host.h" 126 #include "content/public/browser/render_process_host.h"
125 #include "content/public/browser/ssl_status.h" 127 #include "content/public/browser/ssl_status.h"
126 #include "content/public/browser/web_contents.h" 128 #include "content/public/browser/web_contents.h"
127 #include "content/public/common/child_process_host.h" 129 #include "content/public/common/child_process_host.h"
128 #include "content/public/common/common_param_traits.h" 130 #include "content/public/common/common_param_traits.h"
129 #include "net/base/cookie_store.h" 131 #include "net/base/cookie_store.h"
(...skipping 14 matching lines...) Expand all
144 #if defined(OS_CHROMEOS) 146 #if defined(OS_CHROMEOS)
145 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 147 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
146 #include "chrome/browser/ui/webui/active_downloads_ui.h" 148 #include "chrome/browser/ui/webui/active_downloads_ui.h"
147 #else 149 #else
148 #include "chrome/browser/download/download_shelf.h" 150 #include "chrome/browser/download/download_shelf.h"
149 #endif 151 #endif
150 152
151 using automation::Error; 153 using automation::Error;
152 using automation::ErrorCode; 154 using automation::ErrorCode;
153 using automation_util::SendErrorIfModalDialogActive; 155 using automation_util::SendErrorIfModalDialogActive;
156 using content::BrowserChildProcessHostIterator;
154 using content::BrowserThread; 157 using content::BrowserThread;
155 using content::ChildProcessHost; 158 using content::ChildProcessHost;
156 using content::DownloadItem; 159 using content::DownloadItem;
157 using content::DownloadManager; 160 using content::DownloadManager;
158 using content::NavigationController; 161 using content::NavigationController;
159 using content::NavigationEntry; 162 using content::NavigationEntry;
160 using content::PluginService; 163 using content::PluginService;
161 using content::OpenURLParams; 164 using content::OpenURLParams;
162 using content::Referrer; 165 using content::Referrer;
163 using content::SSLStatus; 166 using content::SSLStatus;
(...skipping 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 } 2769 }
2767 reply.SendSuccess(NULL); 2770 reply.SendSuccess(NULL);
2768 return; 2771 return;
2769 } 2772 }
2770 reply.SendError("Invalid action"); 2773 reply.SendError("Invalid action");
2771 } 2774 }
2772 2775
2773 namespace { 2776 namespace {
2774 2777
2775 // Gets info about BrowserChildProcessHost. Must run on IO thread to 2778 // Gets info about BrowserChildProcessHost. Must run on IO thread to
2776 // honor the semantics of BrowserChildProcessHost. 2779 // honor the semantics of BrowserChildProcessHostIterator.
2777 // Used by AutomationProvider::GetBrowserInfo(). 2780 // Used by AutomationProvider::GetBrowserInfo().
2778 void GetChildProcessHostInfo(ListValue* child_processes) { 2781 void GetChildProcessHostInfo(ListValue* child_processes) {
2779 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2782 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
2780 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { 2783 // Only add processes which are already started, since we need their handle.
2781 // Only add processes which are already started, 2784 if (iter.GetData().handle == base::kNullProcessHandle)
2782 // since we need their handle.
2783 if ((*iter)->data().handle == base::kNullProcessHandle)
2784 continue; 2785 continue;
2785 DictionaryValue* item = new DictionaryValue; 2786 DictionaryValue* item = new DictionaryValue;
2786 item->SetString("name", iter->data().name); 2787 item->SetString("name", iter.GetData().name);
2787 item->SetString("type", 2788 item->SetString("type",
2788 content::GetProcessTypeNameInEnglish(iter->data().type)); 2789 content::GetProcessTypeNameInEnglish(iter.GetData().type));
2789 item->SetInteger("pid", base::GetProcId(iter->data().handle)); 2790 item->SetInteger("pid", base::GetProcId(iter.GetData().handle));
2790 child_processes->Append(item); 2791 child_processes->Append(item);
2791 } 2792 }
2792 } 2793 }
2793 2794
2794 } // namespace 2795 } // namespace
2795 2796
2796 // Sample json input: { "command": "GetBrowserInfo" } 2797 // Sample json input: { "command": "GetBrowserInfo" }
2797 // Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for 2798 // Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for
2798 // sample json output. 2799 // sample json output.
2799 void TestingAutomationProvider::GetBrowserInfo( 2800 void TestingAutomationProvider::GetBrowserInfo(
(...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after
6796 6797
6797 Send(reply_message_); 6798 Send(reply_message_);
6798 redirect_query_ = 0; 6799 redirect_query_ = 0;
6799 reply_message_ = NULL; 6800 reply_message_ = NULL;
6800 } 6801 }
6801 6802
6802 void TestingAutomationProvider::OnRemoveProvider() { 6803 void TestingAutomationProvider::OnRemoveProvider() {
6803 if (g_browser_process) 6804 if (g_browser_process)
6804 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6805 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6805 } 6806 }
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698