| 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_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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 455 } |
| 456 return false; | 456 return false; |
| 457 } | 457 } |
| 458 | 458 |
| 459 namespace { | 459 namespace { |
| 460 | 460 |
| 461 bool GetExtensionRenderViewForId( | 461 bool GetExtensionRenderViewForId( |
| 462 const AutomationId& id, | 462 const AutomationId& id, |
| 463 Profile* profile, | 463 Profile* profile, |
| 464 RenderViewHost** rvh) { | 464 RenderViewHost** rvh) { |
| 465 content::ViewType view_type; | |
| 466 switch (id.type()) { | |
| 467 case AutomationId::kTypeExtensionPopup: | |
| 468 view_type = chrome::VIEW_TYPE_EXTENSION_POPUP; | |
| 469 break; | |
| 470 case AutomationId::kTypeExtensionBgPage: | |
| 471 view_type = chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | |
| 472 break; | |
| 473 case AutomationId::kTypeExtensionInfobar: | |
| 474 view_type = chrome::VIEW_TYPE_EXTENSION_INFOBAR; | |
| 475 break; | |
| 476 default: | |
| 477 return false; | |
| 478 } | |
| 479 | |
| 480 ExtensionProcessManager* extension_mgr = | 465 ExtensionProcessManager* extension_mgr = |
| 481 profile->GetExtensionProcessManager(); | 466 profile->GetExtensionProcessManager(); |
| 482 ExtensionProcessManager::const_iterator iter; | 467 ExtensionProcessManager::const_iterator iter; |
| 483 for (iter = extension_mgr->begin(); iter != extension_mgr->end(); | 468 for (iter = extension_mgr->begin(); iter != extension_mgr->end(); |
| 484 ++iter) { | 469 ++iter) { |
| 485 ExtensionHost* host = *iter; | 470 ExtensionHost* host = *iter; |
| 486 AutomationId this_id = GetIdForExtensionView(host); | 471 AutomationId this_id = GetIdForExtensionView(host); |
| 487 if (id == this_id) { | 472 if (id == this_id) { |
| 488 *rvh = host->render_view_host(); | 473 *rvh = host->render_view_host(); |
| 489 return true; | 474 return true; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 const Extension* extension; | 533 const Extension* extension; |
| 549 return GetExtensionForId(id, profile, &extension); | 534 return GetExtensionForId(id, profile, &extension); |
| 550 } | 535 } |
| 551 default: | 536 default: |
| 552 break; | 537 break; |
| 553 } | 538 } |
| 554 return false; | 539 return false; |
| 555 } | 540 } |
| 556 | 541 |
| 557 } // namespace automation_util | 542 } // namespace automation_util |
| OLD | NEW |