OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
9 #include "chrome/browser/automation/automation_provider_list.h" | 9 #include "chrome/browser/automation/automation_provider_list.h" |
10 #include "chrome/browser/automation/ui_controls.h" | 10 #include "chrome/browser/automation/ui_controls.h" |
11 #include "chrome/browser/automation/url_request_failed_dns_job.h" | 11 #include "chrome/browser/automation/url_request_failed_dns_job.h" |
12 #include "chrome/browser/automation/url_request_mock_http_job.h" | 12 #include "chrome/browser/automation/url_request_mock_http_job.h" |
13 #include "chrome/browser/automation/url_request_slow_download_job.h" | 13 #include "chrome/browser/automation/url_request_slow_download_job.h" |
14 #include "chrome/browser/browser_window.h" | 14 #include "chrome/browser/browser_window.h" |
15 #include "chrome/browser/dom_operation_notification_details.h" | 15 #include "chrome/browser/dom_operation_notification_details.h" |
16 #include "chrome/browser/download_manager.h" | 16 #include "chrome/browser/download_manager.h" |
17 #include "chrome/browser/external_tab_container.h" | 17 #include "chrome/browser/external_tab_container.h" |
18 #include "chrome/browser/find_notification_details.h" | 18 #include "chrome/browser/find_notification_details.h" |
19 #include "chrome/browser/login_prompt.h" | 19 #include "chrome/browser/login_prompt.h" |
20 #include "chrome/browser/navigation_entry.h" | 20 #include "chrome/browser/navigation_entry.h" |
21 #include "chrome/browser/printing/print_job.h" | 21 #include "chrome/browser/printing/print_job.h" |
22 #include "chrome/browser/render_view_host.h" | 22 #include "chrome/browser/render_view_host.h" |
23 #include "chrome/browser/save_package.h" | 23 #include "chrome/browser/save_package.h" |
24 #include "chrome/browser/ssl_blocking_page.h" | 24 #include "chrome/browser/ssl_blocking_page.h" |
25 #include "chrome/browser/web_contents.h" | 25 #include "chrome/browser/web_contents.h" |
| 26 #include "chrome/browser/views/bookmark_bar_view.h" |
26 #include "chrome/browser/views/location_bar_view.h" | 27 #include "chrome/browser/views/location_bar_view.h" |
27 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/test/automation/automation_messages.h" | 29 #include "chrome/test/automation/automation_messages.h" |
29 #include "net/base/cookie_monster.h" | 30 #include "net/base/cookie_monster.h" |
30 #include "net/url_request/url_request_filter.h" | 31 #include "net/url_request/url_request_filter.h" |
31 | 32 |
32 class InitialLoadObserver : public NotificationObserver { | 33 class InitialLoadObserver : public NotificationObserver { |
33 public: | 34 public: |
34 InitialLoadObserver(size_t tab_count, AutomationProvider* automation) | 35 InitialLoadObserver(size_t tab_count, AutomationProvider* automation) |
35 : outstanding_tab_count_(tab_count), | 36 : outstanding_tab_count_(tab_count), |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPageRequest, | 749 IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPageRequest, |
749 HandleOpenFindInPageRequest) | 750 HandleOpenFindInPageRequest) |
750 IPC_MESSAGE_HANDLER(AutomationMsg_HandleMessageFromExternalHost, | 751 IPC_MESSAGE_HANDLER(AutomationMsg_HandleMessageFromExternalHost, |
751 OnMessageFromExternalHost) | 752 OnMessageFromExternalHost) |
752 IPC_MESSAGE_HANDLER(AutomationMsg_FindRequest, | 753 IPC_MESSAGE_HANDLER(AutomationMsg_FindRequest, |
753 HandleFindRequest) | 754 HandleFindRequest) |
754 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowVisibilityRequest, | 755 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowVisibilityRequest, |
755 GetFindWindowVisibility) | 756 GetFindWindowVisibility) |
756 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowLocationRequest, | 757 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowLocationRequest, |
757 HandleFindWindowLocationRequest) | 758 HandleFindWindowLocationRequest) |
| 759 IPC_MESSAGE_HANDLER(AutomationMsg_BookmarkBarVisibilityRequest, |
| 760 GetBookmarkBarVisitility) |
758 IPC_END_MESSAGE_MAP() | 761 IPC_END_MESSAGE_MAP() |
759 } | 762 } |
760 | 763 |
761 void AutomationProvider::ActivateTab(const IPC::Message& message, | 764 void AutomationProvider::ActivateTab(const IPC::Message& message, |
762 int handle, int at_index) { | 765 int handle, int at_index) { |
763 int status = -1; | 766 int status = -1; |
764 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 767 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { |
765 Browser* browser = browser_tracker_->GetResource(handle); | 768 Browser* browser = browser_tracker_->GetResource(handle); |
766 if (at_index >= 0 && at_index < browser->tab_count()) { | 769 if (at_index >= 0 && at_index < browser->tab_count()) { |
767 browser->SelectTabContentsAt(at_index, true); | 770 browser->SelectTabContentsAt(at_index, true); |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 const IPC::Message& message, int handle) { | 1716 const IPC::Message& message, int handle) { |
1714 int x = -1, y = -1; | 1717 int x = -1, y = -1; |
1715 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); | 1718 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); |
1716 if (web_contents) | 1719 if (web_contents) |
1717 web_contents->GetFindInPageWindowLocation(&x, &y); | 1720 web_contents->GetFindInPageWindowLocation(&x, &y); |
1718 | 1721 |
1719 Send(new AutomationMsg_FindWindowLocationResponse(message.routing_id(), | 1722 Send(new AutomationMsg_FindWindowLocationResponse(message.routing_id(), |
1720 x, y)); | 1723 x, y)); |
1721 } | 1724 } |
1722 | 1725 |
| 1726 void AutomationProvider::GetBookmarkBarVisitility(const IPC::Message& message, |
| 1727 int handle) { |
| 1728 bool visible = false; |
| 1729 bool animating = false; |
| 1730 |
| 1731 void* iter = NULL; |
| 1732 if (browser_tracker_->ContainsHandle(handle)) { |
| 1733 Browser* browser = browser_tracker_->GetResource(handle); |
| 1734 if (browser) { |
| 1735 BookmarkBarView* bookmark_bar = browser->window()->GetBookmarkBarView(); |
| 1736 if (bookmark_bar) { |
| 1737 animating = bookmark_bar->IsAnimating(); |
| 1738 visible = browser->window()->IsBookmarkBarVisible(); |
| 1739 } |
| 1740 } |
| 1741 } |
| 1742 |
| 1743 Send(new AutomationMsg_BookmarkBarVisibilityResponse(message.routing_id(), |
| 1744 visible, animating)); |
| 1745 } |
| 1746 |
1723 void AutomationProvider::HandleInspectElementRequest( | 1747 void AutomationProvider::HandleInspectElementRequest( |
1724 const IPC::Message& message, int handle, int x, int y) { | 1748 const IPC::Message& message, int handle, int x, int y) { |
1725 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); | 1749 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); |
1726 if (web_contents) { | 1750 if (web_contents) { |
1727 web_contents->InspectElementAt(x, y); | 1751 web_contents->InspectElementAt(x, y); |
1728 inspect_element_routing_id_ = message.routing_id(); | 1752 inspect_element_routing_id_ = message.routing_id(); |
1729 } else { | 1753 } else { |
1730 Send(new AutomationMsg_InspectElementResponse(message.routing_id(), -1)); | 1754 Send(new AutomationMsg_InspectElementResponse(message.routing_id(), -1)); |
1731 } | 1755 } |
1732 } | 1756 } |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 DCHECK(type == NOTIFY_SESSION_END); | 2294 DCHECK(type == NOTIFY_SESSION_END); |
2271 // OnBrowserRemoving does a ReleaseLater. When session end is received we exit | 2295 // OnBrowserRemoving does a ReleaseLater. When session end is received we exit |
2272 // before the task runs resulting in this object not being deleted. This | 2296 // before the task runs resulting in this object not being deleted. This |
2273 // Release balance out the Release scheduled by OnBrowserRemoving. | 2297 // Release balance out the Release scheduled by OnBrowserRemoving. |
2274 Release(); | 2298 Release(); |
2275 } | 2299 } |
2276 | 2300 |
2277 void TestingAutomationProvider::OnRemoveProvider() { | 2301 void TestingAutomationProvider::OnRemoveProvider() { |
2278 AutomationProviderList::GetInstance()->RemoveProvider(this); | 2302 AutomationProviderList::GetInstance()->RemoveProvider(this); |
2279 } | 2303 } |
OLD | NEW |