OLD | NEW |
---|---|
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 13 matching lines...) Expand all Loading... | |
24 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 24 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
28 #include "chrome/common/automation_id.h" | 28 #include "chrome/common/automation_id.h" |
29 #include "chrome/common/chrome_view_type.h" | 29 #include "chrome/common/chrome_view_type.h" |
30 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
33 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
34 #include "content/public/browser/render_view_host_delegate.h" | |
35 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
36 #include "net/cookies/cookie_monster.h" | 35 #include "net/cookies/cookie_monster.h" |
37 #include "net/cookies/cookie_store.h" | 36 #include "net/cookies/cookie_store.h" |
38 #include "net/url_request/url_request_context.h" | 37 #include "net/url_request/url_request_context.h" |
39 #include "net/url_request/url_request_context_getter.h" | 38 #include "net/url_request/url_request_context_getter.h" |
40 | 39 |
41 using content::BrowserThread; | 40 using content::BrowserThread; |
42 using content::RenderViewHost; | 41 using content::RenderViewHost; |
43 using content::WebContents; | 42 using content::WebContents; |
44 | 43 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 | 408 |
410 AutomationId GetIdForTab(const TabContentsWrapper* tab) { | 409 AutomationId GetIdForTab(const TabContentsWrapper* tab) { |
411 return AutomationId( | 410 return AutomationId( |
412 AutomationId::kTypeTab, | 411 AutomationId::kTypeTab, |
413 base::IntToString(tab->restore_tab_helper()->session_id().id())); | 412 base::IntToString(tab->restore_tab_helper()->session_id().id())); |
414 } | 413 } |
415 | 414 |
416 AutomationId GetIdForExtensionView( | 415 AutomationId GetIdForExtensionView( |
417 const content::RenderViewHost* render_view_host) { | 416 const content::RenderViewHost* render_view_host) { |
418 AutomationId::Type type; | 417 AutomationId::Type type; |
419 switch (render_view_host->GetDelegate()->GetRenderViewType()) { | 418 WebContents* web_contents = WebContents::FromRenderViewHost( |
419 const_cast<RenderViewHost*>(render_view_host)); | |
Avi (use Gerrit)
2012/05/23 03:22:52
Eeeewww. Can you please fix FromRenderViewHost to
jam
2012/05/23 04:18:38
Done.
| |
420 switch (chrome::GetViewType(web_contents)) { | |
420 case chrome::VIEW_TYPE_EXTENSION_POPUP: | 421 case chrome::VIEW_TYPE_EXTENSION_POPUP: |
421 type = AutomationId::kTypeExtensionPopup; | 422 type = AutomationId::kTypeExtensionPopup; |
422 break; | 423 break; |
423 case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: | 424 case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: |
424 type = AutomationId::kTypeExtensionBgPage; | 425 type = AutomationId::kTypeExtensionBgPage; |
425 break; | 426 break; |
426 case chrome::VIEW_TYPE_EXTENSION_INFOBAR: | 427 case chrome::VIEW_TYPE_EXTENSION_INFOBAR: |
427 type = AutomationId::kTypeExtensionInfobar; | 428 type = AutomationId::kTypeExtensionInfobar; |
428 break; | 429 break; |
429 default: | 430 default: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 const extensions::Extension* extension; | 554 const extensions::Extension* extension; |
554 return GetExtensionForId(id, profile, &extension); | 555 return GetExtensionForId(id, profile, &extension); |
555 } | 556 } |
556 default: | 557 default: |
557 break; | 558 break; |
558 } | 559 } |
559 return false; | 560 return false; |
560 } | 561 } |
561 | 562 |
562 } // namespace automation_util | 563 } // namespace automation_util |
OLD | NEW |