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