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

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

Issue 10854026: Added webdriver support for App v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a comment. Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/common/automation_id.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_util.h" 5 #include "chrome/browser/automation/automation_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 switch (chrome::GetViewType(web_contents)) { 421 switch (chrome::GetViewType(web_contents)) {
422 case chrome::VIEW_TYPE_EXTENSION_POPUP: 422 case chrome::VIEW_TYPE_EXTENSION_POPUP:
423 type = AutomationId::kTypeExtensionPopup; 423 type = AutomationId::kTypeExtensionPopup;
424 break; 424 break;
425 case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: 425 case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE:
426 type = AutomationId::kTypeExtensionBgPage; 426 type = AutomationId::kTypeExtensionBgPage;
427 break; 427 break;
428 case chrome::VIEW_TYPE_EXTENSION_INFOBAR: 428 case chrome::VIEW_TYPE_EXTENSION_INFOBAR:
429 type = AutomationId::kTypeExtensionInfobar; 429 type = AutomationId::kTypeExtensionInfobar;
430 break; 430 break;
431 case chrome::VIEW_TYPE_APP_SHELL:
432 type = AutomationId::kTypeAppShell;
433 break;
431 default: 434 default:
432 type = AutomationId::kTypeInvalid; 435 type = AutomationId::kTypeInvalid;
433 break; 436 break;
434 } 437 }
435 // Since these extension views do not permit navigation, using the 438 // Since these extension views do not permit navigation, using the
436 // renderer process and view ID should suffice. 439 // renderer process and view ID should suffice.
437 std::string id = base::StringPrintf("%d|%d", 440 std::string id = base::StringPrintf("%d|%d",
438 render_view_host->GetRoutingID(), 441 render_view_host->GetRoutingID(),
439 render_view_host->GetProcess()->GetID()); 442 render_view_host->GetProcess()->GetID());
440 return AutomationId(type, id); 443 return AutomationId(type, id);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 case AutomationId::kTypeTab: { 513 case AutomationId::kTypeTab: {
511 WebContents* tab; 514 WebContents* tab;
512 if (!GetTabForId(id, &tab)) 515 if (!GetTabForId(id, &tab))
513 return false; 516 return false;
514 *rvh = tab->GetRenderViewHost(); 517 *rvh = tab->GetRenderViewHost();
515 break; 518 break;
516 } 519 }
517 case AutomationId::kTypeExtensionPopup: 520 case AutomationId::kTypeExtensionPopup:
518 case AutomationId::kTypeExtensionBgPage: 521 case AutomationId::kTypeExtensionBgPage:
519 case AutomationId::kTypeExtensionInfobar: 522 case AutomationId::kTypeExtensionInfobar:
523 case AutomationId::kTypeAppShell:
520 if (!GetExtensionRenderViewForId(id, profile, rvh)) 524 if (!GetExtensionRenderViewForId(id, profile, rvh))
521 return false; 525 return false;
522 break; 526 break;
523 default: 527 default:
524 return false; 528 return false;
525 } 529 }
526 return true; 530 return true;
527 } 531 }
528 532
529 bool GetExtensionForId( 533 bool GetExtensionForId(
(...skipping 11 matching lines...) Expand all
541 } 545 }
542 546
543 bool DoesObjectWithIdExist(const AutomationId& id, Profile* profile) { 547 bool DoesObjectWithIdExist(const AutomationId& id, Profile* profile) {
544 switch (id.type()) { 548 switch (id.type()) {
545 case AutomationId::kTypeTab: { 549 case AutomationId::kTypeTab: {
546 WebContents* tab; 550 WebContents* tab;
547 return GetTabForId(id, &tab); 551 return GetTabForId(id, &tab);
548 } 552 }
549 case AutomationId::kTypeExtensionPopup: 553 case AutomationId::kTypeExtensionPopup:
550 case AutomationId::kTypeExtensionBgPage: 554 case AutomationId::kTypeExtensionBgPage:
551 case AutomationId::kTypeExtensionInfobar: { 555 case AutomationId::kTypeExtensionInfobar:
556 case AutomationId::kTypeAppShell: {
552 RenderViewHost* rvh; 557 RenderViewHost* rvh;
553 return GetExtensionRenderViewForId(id, profile, &rvh); 558 return GetExtensionRenderViewForId(id, profile, &rvh);
554 } 559 }
555 case AutomationId::kTypeExtension: { 560 case AutomationId::kTypeExtension: {
556 const extensions::Extension* extension; 561 const extensions::Extension* extension;
557 return GetExtensionForId(id, profile, &extension); 562 return GetExtensionForId(id, profile, &extension);
558 } 563 }
559 default: 564 default:
560 break; 565 break;
561 } 566 }
562 return false; 567 return false;
563 } 568 }
564 569
565 } // namespace automation_util 570 } // namespace automation_util
OLDNEW
« no previous file with comments | « no previous file | chrome/common/automation_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698