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

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: fixes for latest siggi review; merge with r83927 Created 9 years, 7 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } else { 226 } else {
227 AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false); 227 AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false);
228 Send(reply_message); 228 Send(reply_message);
229 } 229 }
230 } 230 }
231 231
232 void AutomationProvider::CreateExternalTab( 232 void AutomationProvider::CreateExternalTab(
233 const ExternalTabSettings& settings, 233 const ExternalTabSettings& settings,
234 gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window, 234 gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window,
235 int* tab_handle, int* session_id) { 235 int* tab_handle, int* session_id) {
236 TRACE_EVENT_BEGIN("AutomationProvider::CreateExternalTab", 0, ""); 236 TRACE_EVENT_BEGIN_ETW("AutomationProvider::CreateExternalTab", 0, "");
237 237
238 *tab_handle = 0; 238 *tab_handle = 0;
239 *tab_container_window = NULL; 239 *tab_container_window = NULL;
240 *tab_window = NULL; 240 *tab_window = NULL;
241 *session_id = -1; 241 *session_id = -1;
242 scoped_refptr<ExternalTabContainer> external_tab_container = 242 scoped_refptr<ExternalTabContainer> external_tab_container =
243 new ExternalTabContainer(this, automation_resource_message_filter_); 243 new ExternalTabContainer(this, automation_resource_message_filter_);
244 244
245 Profile* profile = settings.is_incognito ? 245 Profile* profile = settings.is_incognito ?
246 profile_->GetOffTheRecordProfile() : profile_; 246 profile_->GetOffTheRecordProfile() : profile_;
247 247
248 // When the ExternalTabContainer window is created we grab a reference on it 248 // When the ExternalTabContainer window is created we grab a reference on it
249 // which is released when the window is destroyed. 249 // which is released when the window is destroyed.
250 external_tab_container->Init(profile, settings.parent, settings.dimensions, 250 external_tab_container->Init(profile, settings.parent, settings.dimensions,
251 settings.style, settings.load_requests_via_automation, 251 settings.style, settings.load_requests_via_automation,
252 settings.handle_top_level_requests, NULL, settings.initial_url, 252 settings.handle_top_level_requests, NULL, settings.initial_url,
253 settings.referrer, settings.infobars_enabled, 253 settings.referrer, settings.infobars_enabled,
254 settings.route_all_top_level_navigations); 254 settings.route_all_top_level_navigations);
255 255
256 if (AddExternalTab(external_tab_container)) { 256 if (AddExternalTab(external_tab_container)) {
257 TabContents* tab_contents = external_tab_container->tab_contents(); 257 TabContents* tab_contents = external_tab_container->tab_contents();
258 *tab_handle = external_tab_container->tab_handle(); 258 *tab_handle = external_tab_container->tab_handle();
259 *tab_container_window = external_tab_container->GetNativeView(); 259 *tab_container_window = external_tab_container->GetNativeView();
260 *tab_window = tab_contents->GetNativeView(); 260 *tab_window = tab_contents->GetNativeView();
261 *session_id = tab_contents->controller().session_id().id(); 261 *session_id = tab_contents->controller().session_id().id();
262 } else { 262 } else {
263 external_tab_container->Uninitialize(); 263 external_tab_container->Uninitialize();
264 } 264 }
265 265
266 TRACE_EVENT_END("AutomationProvider::CreateExternalTab", 0, ""); 266 TRACE_EVENT_END_ETW("AutomationProvider::CreateExternalTab", 0, "");
267 } 267 }
268 268
269 bool AutomationProvider::AddExternalTab(ExternalTabContainer* external_tab) { 269 bool AutomationProvider::AddExternalTab(ExternalTabContainer* external_tab) {
270 DCHECK(external_tab != NULL); 270 DCHECK(external_tab != NULL);
271 271
272 TabContents* tab_contents = external_tab->tab_contents(); 272 TabContents* tab_contents = external_tab->tab_contents();
273 if (tab_contents) { 273 if (tab_contents) {
274 int tab_handle = tab_tracker_->Add(&tab_contents->controller()); 274 int tab_handle = tab_tracker_->Add(&tab_contents->controller());
275 external_tab->SetTabHandle(tab_handle); 275 external_tab->SetTabHandle(tab_handle);
276 return true; 276 return true;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 367 }
368 368
369 void AutomationProvider::ConnectExternalTab( 369 void AutomationProvider::ConnectExternalTab(
370 uint64 cookie, 370 uint64 cookie,
371 bool allow, 371 bool allow,
372 gfx::NativeWindow parent_window, 372 gfx::NativeWindow parent_window,
373 gfx::NativeWindow* tab_container_window, 373 gfx::NativeWindow* tab_container_window,
374 gfx::NativeWindow* tab_window, 374 gfx::NativeWindow* tab_window,
375 int* tab_handle, 375 int* tab_handle,
376 int* session_id) { 376 int* session_id) {
377 TRACE_EVENT_BEGIN("AutomationProvider::ConnectExternalTab", 0, ""); 377 TRACE_EVENT_BEGIN_ETW("AutomationProvider::ConnectExternalTab", 0, "");
378 378
379 *tab_handle = 0; 379 *tab_handle = 0;
380 *tab_container_window = NULL; 380 *tab_container_window = NULL;
381 *tab_window = NULL; 381 *tab_window = NULL;
382 *session_id = -1; 382 *session_id = -1;
383 383
384 scoped_refptr<ExternalTabContainer> external_tab_container = 384 scoped_refptr<ExternalTabContainer> external_tab_container =
385 ExternalTabContainer::RemovePendingTab(static_cast<uintptr_t>(cookie)); 385 ExternalTabContainer::RemovePendingTab(static_cast<uintptr_t>(cookie));
386 if (!external_tab_container.get()) { 386 if (!external_tab_container.get()) {
387 NOTREACHED(); 387 NOTREACHED();
388 return; 388 return;
389 } 389 }
390 390
391 if (allow && AddExternalTab(external_tab_container)) { 391 if (allow && AddExternalTab(external_tab_container)) {
392 external_tab_container->Reinitialize(this, 392 external_tab_container->Reinitialize(this,
393 automation_resource_message_filter_, 393 automation_resource_message_filter_,
394 parent_window); 394 parent_window);
395 TabContents* tab_contents = external_tab_container->tab_contents(); 395 TabContents* tab_contents = external_tab_container->tab_contents();
396 *tab_handle = external_tab_container->tab_handle(); 396 *tab_handle = external_tab_container->tab_handle();
397 *tab_container_window = external_tab_container->GetNativeView(); 397 *tab_container_window = external_tab_container->GetNativeView();
398 *tab_window = tab_contents->GetNativeView(); 398 *tab_window = tab_contents->GetNativeView();
399 *session_id = tab_contents->controller().session_id().id(); 399 *session_id = tab_contents->controller().session_id().id();
400 } else { 400 } else {
401 external_tab_container->Uninitialize(); 401 external_tab_container->Uninitialize();
402 } 402 }
403 403
404 TRACE_EVENT_END("AutomationProvider::ConnectExternalTab", 0, ""); 404 TRACE_EVENT_END_ETW("AutomationProvider::ConnectExternalTab", 0, "");
405 } 405 }
406 406
407 void AutomationProvider::OnBrowserMoved(int tab_handle) { 407 void AutomationProvider::OnBrowserMoved(int tab_handle) {
408 ExternalTabContainer* external_tab = GetExternalTabForHandle(tab_handle); 408 ExternalTabContainer* external_tab = GetExternalTabForHandle(tab_handle);
409 if (external_tab) { 409 if (external_tab) {
410 external_tab->WindowMoved(); 410 external_tab->WindowMoved();
411 } else { 411 } else {
412 DLOG(WARNING) << 412 DLOG(WARNING) <<
413 "AutomationProvider::OnBrowserMoved called with invalid tab handle."; 413 "AutomationProvider::OnBrowserMoved called with invalid tab handle.";
414 } 414 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 460
461 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { 461 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) {
462 if (tab_tracker_->ContainsHandle(handle)) { 462 if (tab_tracker_->ContainsHandle(handle)) {
463 NavigationController* tab = tab_tracker_->GetResource(handle); 463 NavigationController* tab = tab_tracker_->GetResource(handle);
464 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { 464 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) {
465 tab->tab_contents()->render_view_host()->Zoom( 465 tab->tab_contents()->render_view_host()->Zoom(
466 static_cast<PageZoom::Function>(zoom_level)); 466 static_cast<PageZoom::Function>(zoom_level));
467 } 467 }
468 } 468 }
469 } 469 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698