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

Side by Side Diff: chrome/browser/automation/automation_provider.h

Issue 6012006: Revert 68944 - Revert "Add named testing interface." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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 | « no previous file | chrome/browser/automation/automation_provider.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) 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 // This implements a browser-side endpoint for UI automation activity. 5 // This implements a browser-side endpoint for UI automation activity.
6 // The client-side endpoint is implemented by AutomationProxy. 6 // The client-side endpoint is implemented by AutomationProxy.
7 // The entire lifetime of this object should be contained within that of 7 // The entire lifetime of this object should be contained within that of
8 // the BrowserProcess, and in particular the NotificationService that's 8 // the BrowserProcess, and in particular the NotificationService that's
9 // hung off of it. 9 // hung off of it.
10 10
11 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ 11 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_
12 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ 12 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_
13 #pragma once 13 #pragma once
14 14
15 #include <map> 15 #include <map>
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "base/basictypes.h" 19 #include "base/basictypes.h"
20 #include "base/compiler_specific.h"
20 #include "base/observer_list.h" 21 #include "base/observer_list.h"
21 #include "base/scoped_ptr.h" 22 #include "base/scoped_ptr.h"
22 #include "base/string16.h" 23 #include "base/string16.h"
23 #include "chrome/browser/autofill/field_types.h" 24 #include "chrome/browser/autofill/field_types.h"
24 #include "chrome/browser/cancelable_request.h" 25 #include "chrome/browser/cancelable_request.h"
25 #include "chrome/browser/tab_contents/navigation_entry.h" 26 #include "chrome/browser/tab_contents/navigation_entry.h"
26 #include "chrome/common/automation_constants.h" 27 #include "chrome/common/automation_constants.h"
27 #include "chrome/common/content_settings.h" 28 #include "chrome/common/content_settings.h"
28 #include "chrome/common/notification_observer.h" 29 #include "chrome/common/notification_observer.h"
29 #include "ipc/ipc_message.h" 30 #include "ipc/ipc_message.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 76 }
76 77
77 class AutomationProvider : public base::RefCounted<AutomationProvider>, 78 class AutomationProvider : public base::RefCounted<AutomationProvider>,
78 public IPC::Channel::Listener, 79 public IPC::Channel::Listener,
79 public IPC::Message::Sender { 80 public IPC::Message::Sender {
80 public: 81 public:
81 explicit AutomationProvider(Profile* profile); 82 explicit AutomationProvider(Profile* profile);
82 83
83 Profile* profile() const { return profile_; } 84 Profile* profile() const { return profile_; }
84 85
85 // Establishes a connection to an automation client, if present. 86 // Initializes a channel for a connection to an AutomationProxy.
86 // An AutomationProxy should be established (probably in a different process) 87 // If channel_id starts with kNamedInterfacePrefix, it will act
87 // before calling this. 88 // as a server, create a named IPC socket with channel_id as its
88 void ConnectToChannel(const std::string& channel_id); 89 // path, and will listen on the socket for incoming connections.
90 // If channel_id does not, it will act as a client and establish
91 // a connection on its primary IPC channel. See ipc/ipc_channel_posix.cc
92 // for more information about kPrimaryIPCChannel.
93 bool InitializeChannel(const std::string& channel_id) WARN_UNUSED_RESULT;
89 94
90 // Sets the number of tabs that we expect; when this number of tabs has 95 // Sets the number of tabs that we expect; when this number of tabs has
91 // loaded, an AutomationMsg_InitialLoadsComplete message is sent. 96 // loaded, an AutomationMsg_InitialLoadsComplete message is sent.
92 void SetExpectedTabCount(size_t expected_tabs); 97 void SetExpectedTabCount(size_t expected_tabs);
93 98
99 // Called when the inital set of tabs has finished loading.
100 // Call SetExpectedTabCount(0) to set this to true immediately.
101 void OnInitialLoadsComplete();
102
94 // Add a listener for navigation status notification. Currently only 103 // Add a listener for navigation status notification. Currently only
95 // navigation completion is observed; when the |number_of_navigations| 104 // navigation completion is observed; when the |number_of_navigations|
96 // complete, the completed_response object is sent; if the server requires 105 // complete, the completed_response object is sent; if the server requires
97 // authentication, we instead send the auth_needed_response object. A pointer 106 // authentication, we instead send the auth_needed_response object. A pointer
98 // to the added navigation observer is returned. This object should NOT be 107 // to the added navigation observer is returned. This object should NOT be
99 // deleted and should be released by calling the corresponding 108 // deleted and should be released by calling the corresponding
100 // RemoveNavigationStatusListener method. 109 // RemoveNavigationStatusListener method.
101 NotificationObserver* AddNavigationStatusListener( 110 NotificationObserver* AddNavigationStatusListener(
102 NavigationController* tab, IPC::Message* reply_message, 111 NavigationController* tab, IPC::Message* reply_message,
103 int number_of_navigations, bool include_current_navigation); 112 int number_of_navigations, bool include_current_navigation);
(...skipping 27 matching lines...) Expand all
131 // Add an extension port container. 140 // Add an extension port container.
132 // Takes ownership of the container. 141 // Takes ownership of the container.
133 void AddPortContainer(ExtensionPortContainer* port); 142 void AddPortContainer(ExtensionPortContainer* port);
134 // Remove and delete the port container. 143 // Remove and delete the port container.
135 void RemovePortContainer(ExtensionPortContainer* port); 144 void RemovePortContainer(ExtensionPortContainer* port);
136 // Get the port container for the given port id. 145 // Get the port container for the given port id.
137 ExtensionPortContainer* GetPortContainer(int port_id) const; 146 ExtensionPortContainer* GetPortContainer(int port_id) const;
138 147
139 // IPC implementations 148 // IPC implementations
140 virtual bool Send(IPC::Message* msg); 149 virtual bool Send(IPC::Message* msg);
150 virtual void OnChannelConnected(int pid);
141 virtual void OnMessageReceived(const IPC::Message& msg); 151 virtual void OnMessageReceived(const IPC::Message& msg);
142 virtual void OnChannelError(); 152 virtual void OnChannelError();
143 153
144 IPC::Message* reply_message_release() { 154 IPC::Message* reply_message_release() {
145 IPC::Message* reply_message = reply_message_; 155 IPC::Message* reply_message = reply_message_;
146 reply_message_ = NULL; 156 reply_message_ = NULL;
147 return reply_message; 157 return reply_message;
148 } 158 }
149 159
150 // Adds the extension passed in to the extension tracker, and returns 160 // Adds the extension passed in to the extension tracker, and returns
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 scoped_ptr<IPC::ChannelProxy> channel_; 404 scoped_ptr<IPC::ChannelProxy> channel_;
395 scoped_ptr<NotificationObserver> new_tab_ui_load_observer_; 405 scoped_ptr<NotificationObserver> new_tab_ui_load_observer_;
396 scoped_ptr<NotificationObserver> find_in_page_observer_; 406 scoped_ptr<NotificationObserver> find_in_page_observer_;
397 scoped_ptr<NotificationObserver> dom_operation_observer_; 407 scoped_ptr<NotificationObserver> dom_operation_observer_;
398 scoped_ptr<NotificationObserver> dom_inspector_observer_; 408 scoped_ptr<NotificationObserver> dom_inspector_observer_;
399 scoped_ptr<ExtensionTestResultNotificationObserver> 409 scoped_ptr<ExtensionTestResultNotificationObserver>
400 extension_test_result_observer_; 410 extension_test_result_observer_;
401 scoped_ptr<AutomationExtensionTracker> extension_tracker_; 411 scoped_ptr<AutomationExtensionTracker> extension_tracker_;
402 PortContainerMap port_containers_; 412 PortContainerMap port_containers_;
403 413
414 // True iff connected to an AutomationProxy.
415 bool is_connected_;
416
417 // True iff browser finished loading initial set of tabs.
418 bool initial_loads_complete_;
419
404 DISALLOW_COPY_AND_ASSIGN(AutomationProvider); 420 DISALLOW_COPY_AND_ASSIGN(AutomationProvider);
405 }; 421 };
406 422
407 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ 423 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698