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

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

Issue 6862002: Merge gpu_trace_event back into base/debug/trace_event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "fix gpu/command_buffer/client/cmd_buffer_helper to new macros" Created 9 years, 8 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) 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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/automation/automation_browser_tracker.h" 10 #include "chrome/browser/automation/automation_browser_tracker.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } else { 224 } else {
225 AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false); 225 AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false);
226 Send(reply_message); 226 Send(reply_message);
227 } 227 }
228 } 228 }
229 229
230 void AutomationProvider::CreateExternalTab( 230 void AutomationProvider::CreateExternalTab(
231 const ExternalTabSettings& settings, 231 const ExternalTabSettings& settings,
232 gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window, 232 gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window,
233 int* tab_handle, int* session_id) { 233 int* tab_handle, int* session_id) {
234 TRACE_EVENT_BEGIN("AutomationProvider::CreateExternalTab", 0, ""); 234 TRACE_EVENT_BEGIN_ETW("AutomationProvider::CreateExternalTab", 0, "");
235 235
236 *tab_handle = 0; 236 *tab_handle = 0;
237 *tab_container_window = NULL; 237 *tab_container_window = NULL;
238 *tab_window = NULL; 238 *tab_window = NULL;
239 *session_id = -1; 239 *session_id = -1;
240 scoped_refptr<ExternalTabContainer> external_tab_container = 240 scoped_refptr<ExternalTabContainer> external_tab_container =
241 new ExternalTabContainer(this, automation_resource_message_filter_); 241 new ExternalTabContainer(this, automation_resource_message_filter_);
242 242
243 Profile* profile = settings.is_incognito ? 243 Profile* profile = settings.is_incognito ?
244 profile_->GetOffTheRecordProfile() : profile_; 244 profile_->GetOffTheRecordProfile() : profile_;
245 245
246 // When the ExternalTabContainer window is created we grab a reference on it 246 // When the ExternalTabContainer window is created we grab a reference on it
247 // which is released when the window is destroyed. 247 // which is released when the window is destroyed.
248 external_tab_container->Init(profile, settings.parent, settings.dimensions, 248 external_tab_container->Init(profile, settings.parent, settings.dimensions,
249 settings.style, settings.load_requests_via_automation, 249 settings.style, settings.load_requests_via_automation,
250 settings.handle_top_level_requests, NULL, settings.initial_url, 250 settings.handle_top_level_requests, NULL, settings.initial_url,
251 settings.referrer, settings.infobars_enabled, 251 settings.referrer, settings.infobars_enabled,
252 settings.route_all_top_level_navigations); 252 settings.route_all_top_level_navigations);
253 253
254 if (AddExternalTab(external_tab_container)) { 254 if (AddExternalTab(external_tab_container)) {
255 TabContents* tab_contents = external_tab_container->tab_contents(); 255 TabContents* tab_contents = external_tab_container->tab_contents();
256 *tab_handle = external_tab_container->tab_handle(); 256 *tab_handle = external_tab_container->tab_handle();
257 *tab_container_window = external_tab_container->GetNativeView(); 257 *tab_container_window = external_tab_container->GetNativeView();
258 *tab_window = tab_contents->GetNativeView(); 258 *tab_window = tab_contents->GetNativeView();
259 *session_id = tab_contents->controller().session_id().id(); 259 *session_id = tab_contents->controller().session_id().id();
260 } else { 260 } else {
261 external_tab_container->Uninitialize(); 261 external_tab_container->Uninitialize();
262 } 262 }
263 263
264 TRACE_EVENT_END("AutomationProvider::CreateExternalTab", 0, ""); 264 TRACE_EVENT_END_ETW("AutomationProvider::CreateExternalTab", 0, "");
265 } 265 }
266 266
267 bool AutomationProvider::AddExternalTab(ExternalTabContainer* external_tab) { 267 bool AutomationProvider::AddExternalTab(ExternalTabContainer* external_tab) {
268 DCHECK(external_tab != NULL); 268 DCHECK(external_tab != NULL);
269 269
270 TabContents* tab_contents = external_tab->tab_contents(); 270 TabContents* tab_contents = external_tab->tab_contents();
271 if (tab_contents) { 271 if (tab_contents) {
272 int tab_handle = tab_tracker_->Add(&tab_contents->controller()); 272 int tab_handle = tab_tracker_->Add(&tab_contents->controller());
273 external_tab->SetTabHandle(tab_handle); 273 external_tab->SetTabHandle(tab_handle);
274 return true; 274 return true;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 365
366 void AutomationProvider::ConnectExternalTab( 366 void AutomationProvider::ConnectExternalTab(
367 uint64 cookie, 367 uint64 cookie,
368 bool allow, 368 bool allow,
369 gfx::NativeWindow parent_window, 369 gfx::NativeWindow parent_window,
370 gfx::NativeWindow* tab_container_window, 370 gfx::NativeWindow* tab_container_window,
371 gfx::NativeWindow* tab_window, 371 gfx::NativeWindow* tab_window,
372 int* tab_handle, 372 int* tab_handle,
373 int* session_id) { 373 int* session_id) {
374 TRACE_EVENT_BEGIN("AutomationProvider::ConnectExternalTab", 0, ""); 374 TRACE_EVENT_BEGIN_ETW("AutomationProvider::ConnectExternalTab", 0, "");
375 375
376 *tab_handle = 0; 376 *tab_handle = 0;
377 *tab_container_window = NULL; 377 *tab_container_window = NULL;
378 *tab_window = NULL; 378 *tab_window = NULL;
379 *session_id = -1; 379 *session_id = -1;
380 380
381 scoped_refptr<ExternalTabContainer> external_tab_container = 381 scoped_refptr<ExternalTabContainer> external_tab_container =
382 ExternalTabContainer::RemovePendingTab(static_cast<uintptr_t>(cookie)); 382 ExternalTabContainer::RemovePendingTab(static_cast<uintptr_t>(cookie));
383 if (!external_tab_container.get()) { 383 if (!external_tab_container.get()) {
384 NOTREACHED(); 384 NOTREACHED();
385 return; 385 return;
386 } 386 }
387 387
388 if (allow && AddExternalTab(external_tab_container)) { 388 if (allow && AddExternalTab(external_tab_container)) {
389 external_tab_container->Reinitialize(this, 389 external_tab_container->Reinitialize(this,
390 automation_resource_message_filter_, 390 automation_resource_message_filter_,
391 parent_window); 391 parent_window);
392 TabContents* tab_contents = external_tab_container->tab_contents(); 392 TabContents* tab_contents = external_tab_container->tab_contents();
393 *tab_handle = external_tab_container->tab_handle(); 393 *tab_handle = external_tab_container->tab_handle();
394 *tab_container_window = external_tab_container->GetNativeView(); 394 *tab_container_window = external_tab_container->GetNativeView();
395 *tab_window = tab_contents->GetNativeView(); 395 *tab_window = tab_contents->GetNativeView();
396 *session_id = tab_contents->controller().session_id().id(); 396 *session_id = tab_contents->controller().session_id().id();
397 } else { 397 } else {
398 external_tab_container->Uninitialize(); 398 external_tab_container->Uninitialize();
399 } 399 }
400 400
401 TRACE_EVENT_END("AutomationProvider::ConnectExternalTab", 0, ""); 401 TRACE_EVENT_END_ETW("AutomationProvider::ConnectExternalTab", 0, "");
402 } 402 }
403 403
404 void AutomationProvider::OnBrowserMoved(int tab_handle) { 404 void AutomationProvider::OnBrowserMoved(int tab_handle) {
405 ExternalTabContainer* external_tab = GetExternalTabForHandle(tab_handle); 405 ExternalTabContainer* external_tab = GetExternalTabForHandle(tab_handle);
406 if (external_tab) { 406 if (external_tab) {
407 external_tab->WindowMoved(); 407 external_tab->WindowMoved();
408 } else { 408 } else {
409 DLOG(WARNING) << 409 DLOG(WARNING) <<
410 "AutomationProvider::OnBrowserMoved called with invalid tab handle."; 410 "AutomationProvider::OnBrowserMoved called with invalid tab handle.";
411 } 411 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { 457 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) {
458 if (tab_tracker_->ContainsHandle(handle)) { 458 if (tab_tracker_->ContainsHandle(handle)) {
459 NavigationController* tab = tab_tracker_->GetResource(handle); 459 NavigationController* tab = tab_tracker_->GetResource(handle);
460 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { 460 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) {
461 tab->tab_contents()->render_view_host()->Zoom( 461 tab->tab_contents()->render_view_host()->Zoom(
462 static_cast<PageZoom::Function>(zoom_level)); 462 static_cast<PageZoom::Function>(zoom_level));
463 } 463 }
464 } 464 }
465 } 465 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698