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" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/automation/automation_provider.h" | 16 #include "chrome/browser/automation/automation_provider.h" |
17 #include "chrome/browser/automation/automation_provider_json.h" | 17 #include "chrome/browser/automation/automation_provider_json.h" |
18 #include "chrome/browser/extensions/extension_process_manager.h" | 18 #include "chrome/browser/extensions/extension_process_manager.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
20 #include "chrome/browser/printing/print_preview_tab_controller.h" | 20 #include "chrome/browser/printing/print_preview_tab_controller.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/sessions/restore_tab_helper.h" | 22 #include "chrome/browser/sessions/restore_tab_helper.h" |
23 #include "chrome/browser/sessions/session_id.h" | 23 #include "chrome/browser/sessions/session_id.h" |
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/browser/view_type_utils.h" |
28 #include "chrome/common/automation_id.h" | 29 #include "chrome/common/automation_id.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(render_view_host); |
| 419 switch (chrome::GetViewType(web_contents)) { |
420 case chrome::VIEW_TYPE_EXTENSION_POPUP: | 420 case chrome::VIEW_TYPE_EXTENSION_POPUP: |
421 type = AutomationId::kTypeExtensionPopup; | 421 type = AutomationId::kTypeExtensionPopup; |
422 break; | 422 break; |
423 case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: | 423 case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: |
424 type = AutomationId::kTypeExtensionBgPage; | 424 type = AutomationId::kTypeExtensionBgPage; |
425 break; | 425 break; |
426 case chrome::VIEW_TYPE_EXTENSION_INFOBAR: | 426 case chrome::VIEW_TYPE_EXTENSION_INFOBAR: |
427 type = AutomationId::kTypeExtensionInfobar; | 427 type = AutomationId::kTypeExtensionInfobar; |
428 break; | 428 break; |
429 default: | 429 default: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 const extensions::Extension* extension; | 553 const extensions::Extension* extension; |
554 return GetExtensionForId(id, profile, &extension); | 554 return GetExtensionForId(id, profile, &extension); |
555 } | 555 } |
556 default: | 556 default: |
557 break; | 557 break; |
558 } | 558 } |
559 return false; | 559 return false; |
560 } | 560 } |
561 | 561 |
562 } // namespace automation_util | 562 } // namespace automation_util |
OLD | NEW |