OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 using base::Time; | 105 using base::Time; |
106 | 106 |
107 AutomationProvider::AutomationProvider(Profile* profile) | 107 AutomationProvider::AutomationProvider(Profile* profile) |
108 : profile_(profile), | 108 : profile_(profile), |
109 reply_message_(NULL), | 109 reply_message_(NULL), |
110 reinitialize_on_channel_error_(false), | 110 reinitialize_on_channel_error_(false), |
111 is_connected_(false), | 111 is_connected_(false), |
112 initial_tab_loads_complete_(false), | 112 initial_tab_loads_complete_(false), |
113 network_library_initialized_(true) { | 113 network_library_initialized_(true) { |
114 TRACE_EVENT_BEGIN("AutomationProvider::AutomationProvider", 0, ""); | 114 TRACE_EVENT_BEGIN_ETW("AutomationProvider::AutomationProvider", 0, ""); |
115 | 115 |
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
117 | 117 |
118 browser_tracker_.reset(new AutomationBrowserTracker(this)); | 118 browser_tracker_.reset(new AutomationBrowserTracker(this)); |
119 extension_tracker_.reset(new AutomationExtensionTracker(this)); | 119 extension_tracker_.reset(new AutomationExtensionTracker(this)); |
120 tab_tracker_.reset(new AutomationTabTracker(this)); | 120 tab_tracker_.reset(new AutomationTabTracker(this)); |
121 window_tracker_.reset(new AutomationWindowTracker(this)); | 121 window_tracker_.reset(new AutomationWindowTracker(this)); |
122 autocomplete_edit_tracker_.reset( | 122 autocomplete_edit_tracker_.reset( |
123 new AutomationAutocompleteEditTracker(this)); | 123 new AutomationAutocompleteEditTracker(this)); |
124 new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this)); | 124 new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this)); |
125 metric_event_duration_observer_.reset(new MetricEventDurationObserver()); | 125 metric_event_duration_observer_.reset(new MetricEventDurationObserver()); |
126 extension_test_result_observer_.reset( | 126 extension_test_result_observer_.reset( |
127 new ExtensionTestResultNotificationObserver(this)); | 127 new ExtensionTestResultNotificationObserver(this)); |
128 g_browser_process->AddRefModule(); | 128 g_browser_process->AddRefModule(); |
129 | 129 |
130 TRACE_EVENT_END("AutomationProvider::AutomationProvider", 0, ""); | 130 TRACE_EVENT_END_ETW("AutomationProvider::AutomationProvider", 0, ""); |
131 } | 131 } |
132 | 132 |
133 AutomationProvider::~AutomationProvider() { | 133 AutomationProvider::~AutomationProvider() { |
134 if (channel_.get()) | 134 if (channel_.get()) |
135 channel_->Close(); | 135 channel_->Close(); |
136 | 136 |
137 g_browser_process->ReleaseModule(); | 137 g_browser_process->ReleaseModule(); |
138 } | 138 } |
139 | 139 |
140 bool AutomationProvider::InitializeChannel(const std::string& channel_id) { | 140 bool AutomationProvider::InitializeChannel(const std::string& channel_id) { |
141 TRACE_EVENT_BEGIN("AutomationProvider::InitializeChannel", 0, ""); | 141 TRACE_EVENT_BEGIN_ETW("AutomationProvider::InitializeChannel", 0, ""); |
142 | 142 |
143 channel_id_ = channel_id; | 143 channel_id_ = channel_id; |
144 std::string effective_channel_id = channel_id; | 144 std::string effective_channel_id = channel_id; |
145 | 145 |
146 // If the channel_id starts with kNamedInterfacePrefix, create a named IPC | 146 // If the channel_id starts with kNamedInterfacePrefix, create a named IPC |
147 // server and listen on it, else connect as client to an existing IPC server | 147 // server and listen on it, else connect as client to an existing IPC server |
148 bool use_named_interface = | 148 bool use_named_interface = |
149 channel_id.find(automation::kNamedInterfacePrefix) == 0; | 149 channel_id.find(automation::kNamedInterfacePrefix) == 0; |
150 if (use_named_interface) { | 150 if (use_named_interface) { |
151 effective_channel_id = channel_id.substr( | 151 effective_channel_id = channel_id.substr( |
(...skipping 19 matching lines...) Expand all Loading... |
171 | 171 |
172 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
173 // Wait for the network manager to initialize. | 173 // Wait for the network manager to initialize. |
174 // The observer will delete itself when done. | 174 // The observer will delete itself when done. |
175 network_library_initialized_ = false; | 175 network_library_initialized_ = false; |
176 NetworkManagerInitObserver* observer = new NetworkManagerInitObserver(this); | 176 NetworkManagerInitObserver* observer = new NetworkManagerInitObserver(this); |
177 if (!observer->Init()) | 177 if (!observer->Init()) |
178 delete observer; | 178 delete observer; |
179 #endif | 179 #endif |
180 | 180 |
181 TRACE_EVENT_END("AutomationProvider::InitializeChannel", 0, ""); | 181 TRACE_EVENT_END_ETW("AutomationProvider::InitializeChannel", 0, ""); |
182 | 182 |
183 return true; | 183 return true; |
184 } | 184 } |
185 | 185 |
186 std::string AutomationProvider::GetProtocolVersion() { | 186 std::string AutomationProvider::GetProtocolVersion() { |
187 chrome::VersionInfo version_info; | 187 chrome::VersionInfo version_info; |
188 return version_info.Version().c_str(); | 188 return version_info.Version().c_str(); |
189 } | 189 } |
190 | 190 |
191 void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) { | 191 void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) { |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 | 963 |
964 void AutomationProvider::SaveAsAsync(int tab_handle) { | 964 void AutomationProvider::SaveAsAsync(int tab_handle) { |
965 NavigationController* tab = NULL; | 965 NavigationController* tab = NULL; |
966 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 966 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
967 if (tab_contents) { | 967 if (tab_contents) { |
968 TabContentsWrapper* wrapper = | 968 TabContentsWrapper* wrapper = |
969 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 969 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
970 wrapper->download_tab_helper()->OnSavePage(); | 970 wrapper->download_tab_helper()->OnSavePage(); |
971 } | 971 } |
972 } | 972 } |
OLD | NEW |