| 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 #include "chrome/common/extensions/url_pattern_set.h" | 118 #include "chrome/common/extensions/url_pattern_set.h" |
| 119 #include "chrome/common/pref_names.h" | 119 #include "chrome/common/pref_names.h" |
| 120 #include "chrome/common/render_messages.h" | 120 #include "chrome/common/render_messages.h" |
| 121 #include "chrome/common/url_constants.h" | 121 #include "chrome/common/url_constants.h" |
| 122 #include "content/browser/renderer_host/render_view_host.h" | 122 #include "content/browser/renderer_host/render_view_host.h" |
| 123 #include "content/browser/renderer_host/render_widget_host_view.h" | 123 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 124 #include "content/browser/tab_contents/interstitial_page.h" | 124 #include "content/browser/tab_contents/interstitial_page.h" |
| 125 #include "content/public/browser/browser_child_process_host_iterator.h" | 125 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 126 #include "content/public/browser/child_process_data.h" | 126 #include "content/public/browser/child_process_data.h" |
| 127 #include "content/public/browser/favicon_status.h" | 127 #include "content/public/browser/favicon_status.h" |
| 128 #include "content/public/browser/interstitial_page_delegate.h" |
| 128 #include "content/public/browser/navigation_entry.h" | 129 #include "content/public/browser/navigation_entry.h" |
| 129 #include "content/public/browser/notification_service.h" | 130 #include "content/public/browser/notification_service.h" |
| 130 #include "content/public/browser/plugin_service.h" | 131 #include "content/public/browser/plugin_service.h" |
| 131 #include "content/public/browser/render_process_host.h" | 132 #include "content/public/browser/render_process_host.h" |
| 132 #include "content/public/browser/ssl_status.h" | 133 #include "content/public/browser/ssl_status.h" |
| 133 #include "content/public/browser/web_contents.h" | 134 #include "content/public/browser/web_contents.h" |
| 134 #include "content/public/common/child_process_host.h" | 135 #include "content/public/common/child_process_host.h" |
| 135 #include "content/public/common/common_param_traits.h" | 136 #include "content/public/common/common_param_traits.h" |
| 136 #include "net/base/cookie_store.h" | 137 #include "net/base/cookie_store.h" |
| 137 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 138 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } else if ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) == | 189 } else if ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) == |
| 189 ui::EF_MIDDLE_MOUSE_BUTTON) { | 190 ui::EF_MIDDLE_MOUSE_BUTTON) { |
| 190 button = ui_controls::MIDDLE; | 191 button = ui_controls::MIDDLE; |
| 191 } else { | 192 } else { |
| 192 NOTREACHED(); | 193 NOTREACHED(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 ui_controls::SendMouseClick(button); | 196 ui_controls::SendMouseClick(button); |
| 196 } | 197 } |
| 197 | 198 |
| 198 class AutomationInterstitialPage : public InterstitialPage { | 199 class AutomationInterstitialPage : public content::InterstitialPageDelegate { |
| 199 public: | 200 public: |
| 200 AutomationInterstitialPage(WebContents* tab, | 201 AutomationInterstitialPage(WebContents* tab, |
| 201 const GURL& url, | 202 const GURL& url, |
| 202 const std::string& contents) | 203 const std::string& contents) |
| 203 : InterstitialPage(tab, true, url), | 204 : contents_(contents) { |
| 204 contents_(contents) { | 205 interstitial_page_ = InterstitialPage::Create(tab, true, url, this); |
| 206 interstitial_page_->Show(); |
| 205 } | 207 } |
| 206 | 208 |
| 207 virtual std::string GetHTMLContents() { return contents_; } | 209 virtual std::string GetHTMLContents() OVERRIDE { return contents_; } |
| 208 | 210 |
| 209 private: | 211 private: |
| 210 const std::string contents_; | 212 const std::string contents_; |
| 213 InterstitialPage* interstitial_page_; // Owns us. |
| 211 | 214 |
| 212 DISALLOW_COPY_AND_ASSIGN(AutomationInterstitialPage); | 215 DISALLOW_COPY_AND_ASSIGN(AutomationInterstitialPage); |
| 213 }; | 216 }; |
| 214 | 217 |
| 215 } // namespace | 218 } // namespace |
| 216 | 219 |
| 217 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) | 220 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) |
| 218 : AutomationProvider(profile), | 221 : AutomationProvider(profile), |
| 219 #if defined(TOOLKIT_VIEWS) | 222 #if defined(TOOLKIT_VIEWS) |
| 220 popup_menu_waiter_(NULL), | 223 popup_menu_waiter_(NULL), |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 int tab_handle, | 1582 int tab_handle, |
| 1580 const std::string& html_text, | 1583 const std::string& html_text, |
| 1581 IPC::Message* reply_message) { | 1584 IPC::Message* reply_message) { |
| 1582 if (tab_tracker_->ContainsHandle(tab_handle)) { | 1585 if (tab_tracker_->ContainsHandle(tab_handle)) { |
| 1583 NavigationController* controller = tab_tracker_->GetResource(tab_handle); | 1586 NavigationController* controller = tab_tracker_->GetResource(tab_handle); |
| 1584 WebContents* web_contents = controller->GetWebContents(); | 1587 WebContents* web_contents = controller->GetWebContents(); |
| 1585 | 1588 |
| 1586 new NavigationNotificationObserver(controller, this, reply_message, 1, | 1589 new NavigationNotificationObserver(controller, this, reply_message, 1, |
| 1587 false, false); | 1590 false, false); |
| 1588 | 1591 |
| 1589 AutomationInterstitialPage* interstitial = | 1592 new AutomationInterstitialPage( |
| 1590 new AutomationInterstitialPage(web_contents, | 1593 web_contents, GURL("about:interstitial"), html_text); |
| 1591 GURL("about:interstitial"), | |
| 1592 html_text); | |
| 1593 interstitial->Show(); | |
| 1594 return; | 1594 return; |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 AutomationMsg_ShowInterstitialPage::WriteReplyParams( | 1597 AutomationMsg_ShowInterstitialPage::WriteReplyParams( |
| 1598 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); | 1598 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); |
| 1599 Send(reply_message); | 1599 Send(reply_message); |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 void TestingAutomationProvider::HideInterstitialPage(int tab_handle, | 1602 void TestingAutomationProvider::HideInterstitialPage(int tab_handle, |
| 1603 bool* success) { | 1603 bool* success) { |
| (...skipping 5336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6940 | 6940 |
| 6941 Send(reply_message_); | 6941 Send(reply_message_); |
| 6942 redirect_query_ = 0; | 6942 redirect_query_ = 0; |
| 6943 reply_message_ = NULL; | 6943 reply_message_ = NULL; |
| 6944 } | 6944 } |
| 6945 | 6945 |
| 6946 void TestingAutomationProvider::OnRemoveProvider() { | 6946 void TestingAutomationProvider::OnRemoveProvider() { |
| 6947 if (g_browser_process) | 6947 if (g_browser_process) |
| 6948 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6948 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6949 } | 6949 } |
| OLD | NEW |