Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 8956059: Rename NavigationController to NavigationControllerImpl and put it into the content namespace. Al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/content_settings/tab_specific_content_settings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 #include "chrome/browser/download/download_shelf.h" 148 #include "chrome/browser/download/download_shelf.h"
149 #endif 149 #endif
150 150
151 using automation::Error; 151 using automation::Error;
152 using automation::ErrorCode; 152 using automation::ErrorCode;
153 using automation_util::SendErrorIfModalDialogActive; 153 using automation_util::SendErrorIfModalDialogActive;
154 using content::BrowserThread; 154 using content::BrowserThread;
155 using content::ChildProcessHost; 155 using content::ChildProcessHost;
156 using content::DownloadItem; 156 using content::DownloadItem;
157 using content::DownloadManager; 157 using content::DownloadManager;
158 using content::NavigationEntry;
158 using content::PluginService; 159 using content::PluginService;
159 using content::OpenURLParams; 160 using content::OpenURLParams;
160 using content::Referrer; 161 using content::Referrer;
161 using content::SSLStatus; 162 using content::SSLStatus;
162 using content::WebContents; 163 using content::WebContents;
163 164
164 namespace { 165 namespace {
165 166
166 void SendMouseClick(int flags) { 167 void SendMouseClick(int flags) {
167 ui_controls::MouseButton button = ui_controls::LEFT; 168 ui_controls::MouseButton button = ui_controls::LEFT;
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 *process_id = base::GetProcId(rph->GetHandle()); 1278 *process_id = base::GetProcId(rph->GetHandle());
1278 } 1279 }
1279 } 1280 }
1280 1281
1281 void TestingAutomationProvider::GetTabTitle(int handle, 1282 void TestingAutomationProvider::GetTabTitle(int handle,
1282 int* title_string_size, 1283 int* title_string_size,
1283 std::wstring* title) { 1284 std::wstring* title) {
1284 *title_string_size = -1; // -1 is the error code 1285 *title_string_size = -1; // -1 is the error code
1285 if (tab_tracker_->ContainsHandle(handle)) { 1286 if (tab_tracker_->ContainsHandle(handle)) {
1286 NavigationController* tab = tab_tracker_->GetResource(handle); 1287 NavigationController* tab = tab_tracker_->GetResource(handle);
1287 content::NavigationEntry* entry = tab->GetActiveEntry(); 1288 NavigationEntry* entry = tab->GetActiveEntry();
1288 if (entry != NULL) { 1289 if (entry != NULL) {
1289 *title = UTF16ToWideHack(entry->GetTitleForDisplay("")); 1290 *title = UTF16ToWideHack(entry->GetTitleForDisplay(""));
1290 } else { 1291 } else {
1291 *title = std::wstring(); 1292 *title = std::wstring();
1292 } 1293 }
1293 *title_string_size = static_cast<int>(title->size()); 1294 *title_string_size = static_cast<int>(title->size());
1294 } 1295 }
1295 } 1296 }
1296 1297
1297 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) { 1298 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 } 1567 }
1567 1568
1568 void TestingAutomationProvider::GetSecurityState( 1569 void TestingAutomationProvider::GetSecurityState(
1569 int handle, 1570 int handle,
1570 bool* success, 1571 bool* success,
1571 content::SecurityStyle* security_style, 1572 content::SecurityStyle* security_style,
1572 net::CertStatus* ssl_cert_status, 1573 net::CertStatus* ssl_cert_status,
1573 int* insecure_content_status) { 1574 int* insecure_content_status) {
1574 if (tab_tracker_->ContainsHandle(handle)) { 1575 if (tab_tracker_->ContainsHandle(handle)) {
1575 NavigationController* tab = tab_tracker_->GetResource(handle); 1576 NavigationController* tab = tab_tracker_->GetResource(handle);
1576 content::NavigationEntry* entry = tab->GetActiveEntry(); 1577 NavigationEntry* entry = tab->GetActiveEntry();
1577 *success = true; 1578 *success = true;
1578 *security_style = entry->GetSSL().security_style; 1579 *security_style = entry->GetSSL().security_style;
1579 *ssl_cert_status = entry->GetSSL().cert_status; 1580 *ssl_cert_status = entry->GetSSL().cert_status;
1580 *insecure_content_status = entry->GetSSL().content_status; 1581 *insecure_content_status = entry->GetSSL().content_status;
1581 } else { 1582 } else {
1582 *success = false; 1583 *success = false;
1583 *security_style = content::SECURITY_STYLE_UNKNOWN; 1584 *security_style = content::SECURITY_STYLE_UNKNOWN;
1584 *ssl_cert_status = 0; 1585 *ssl_cert_status = 0;
1585 *insecure_content_status = 0; 1586 *insecure_content_status = 0;
1586 } 1587 }
1587 } 1588 }
1588 1589
1589 void TestingAutomationProvider::GetPageType( 1590 void TestingAutomationProvider::GetPageType(
1590 int handle, 1591 int handle,
1591 bool* success, 1592 bool* success,
1592 content::PageType* page_type) { 1593 content::PageType* page_type) {
1593 if (tab_tracker_->ContainsHandle(handle)) { 1594 if (tab_tracker_->ContainsHandle(handle)) {
1594 NavigationController* tab = tab_tracker_->GetResource(handle); 1595 NavigationController* tab = tab_tracker_->GetResource(handle);
1595 content::NavigationEntry* entry = tab->GetActiveEntry(); 1596 NavigationEntry* entry = tab->GetActiveEntry();
1596 *page_type = entry->GetPageType(); 1597 *page_type = entry->GetPageType();
1597 *success = true; 1598 *success = true;
1598 // In order to return the proper result when an interstitial is shown and 1599 // In order to return the proper result when an interstitial is shown and
1599 // no navigation entry were created for it we need to ask the TabContents. 1600 // no navigation entry were created for it we need to ask the TabContents.
1600 if (*page_type == content::PAGE_TYPE_NORMAL && 1601 if (*page_type == content::PAGE_TYPE_NORMAL &&
1601 tab->tab_contents()->ShowingInterstitialPage()) 1602 tab->tab_contents()->ShowingInterstitialPage())
1602 *page_type = content::PAGE_TYPE_INTERSTITIAL; 1603 *page_type = content::PAGE_TYPE_INTERSTITIAL;
1603 } else { 1604 } else {
1604 *success = false; 1605 *success = false;
1605 *page_type = content::PAGE_TYPE_NORMAL; 1606 *page_type = content::PAGE_TYPE_NORMAL;
1606 } 1607 }
1607 } 1608 }
1608 1609
1609 void TestingAutomationProvider::GetMetricEventDuration( 1610 void TestingAutomationProvider::GetMetricEventDuration(
1610 const std::string& event_name, 1611 const std::string& event_name,
1611 int* duration_ms) { 1612 int* duration_ms) {
1612 *duration_ms = metric_event_duration_observer_->GetEventDurationMs( 1613 *duration_ms = metric_event_duration_observer_->GetEventDurationMs(
1613 event_name); 1614 event_name);
1614 } 1615 }
1615 1616
1616 void TestingAutomationProvider::ActionOnSSLBlockingPage( 1617 void TestingAutomationProvider::ActionOnSSLBlockingPage(
1617 int handle, 1618 int handle,
1618 bool proceed, 1619 bool proceed,
1619 IPC::Message* reply_message) { 1620 IPC::Message* reply_message) {
1620 if (tab_tracker_->ContainsHandle(handle)) { 1621 if (tab_tracker_->ContainsHandle(handle)) {
1621 NavigationController* tab = tab_tracker_->GetResource(handle); 1622 NavigationController* tab = tab_tracker_->GetResource(handle);
1622 content::NavigationEntry* entry = tab->GetActiveEntry(); 1623 NavigationEntry* entry = tab->GetActiveEntry();
1623 if (entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) { 1624 if (entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) {
1624 TabContents* tab_contents = tab->tab_contents(); 1625 TabContents* tab_contents = tab->tab_contents();
1625 InterstitialPage* ssl_blocking_page = 1626 InterstitialPage* ssl_blocking_page =
1626 InterstitialPage::GetInterstitialPage(tab_contents); 1627 InterstitialPage::GetInterstitialPage(tab_contents);
1627 if (ssl_blocking_page) { 1628 if (ssl_blocking_page) {
1628 if (proceed) { 1629 if (proceed) {
1629 new NavigationNotificationObserver(tab, this, reply_message, 1, 1630 new NavigationNotificationObserver(tab, this, reply_message, 1,
1630 false, false); 1631 false, false);
1631 ssl_blocking_page->Proceed(); 1632 ssl_blocking_page->Proceed();
1632 return; 1633 return;
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2965 AutomationJSONReply reply(this, reply_message); 2966 AutomationJSONReply reply(this, reply_message);
2966 int tab_index; 2967 int tab_index;
2967 TabContents* tab_contents = NULL; 2968 TabContents* tab_contents = NULL;
2968 if (!args->GetInteger("tab_index", &tab_index) || 2969 if (!args->GetInteger("tab_index", &tab_index) ||
2969 !(tab_contents = browser->GetTabContentsAt(tab_index))) { 2970 !(tab_contents = browser->GetTabContentsAt(tab_index))) {
2970 reply.SendError("tab_index missing or invalid."); 2971 reply.SendError("tab_index missing or invalid.");
2971 return; 2972 return;
2972 } 2973 }
2973 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 2974 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
2974 const NavigationController& controller = tab_contents->GetController(); 2975 const NavigationController& controller = tab_contents->GetController();
2975 content::NavigationEntry* nav_entry = controller.GetActiveEntry(); 2976 NavigationEntry* nav_entry = controller.GetActiveEntry();
2976 DCHECK(nav_entry); 2977 DCHECK(nav_entry);
2977 2978
2978 // Security info. 2979 // Security info.
2979 DictionaryValue* ssl = new DictionaryValue; 2980 DictionaryValue* ssl = new DictionaryValue;
2980 std::map<content::SecurityStyle, std::string> style_to_string; 2981 std::map<content::SecurityStyle, std::string> style_to_string;
2981 style_to_string[content::SECURITY_STYLE_UNKNOWN] = "SECURITY_STYLE_UNKNOWN"; 2982 style_to_string[content::SECURITY_STYLE_UNKNOWN] = "SECURITY_STYLE_UNKNOWN";
2982 style_to_string[content::SECURITY_STYLE_UNAUTHENTICATED] = 2983 style_to_string[content::SECURITY_STYLE_UNAUTHENTICATED] =
2983 "SECURITY_STYLE_UNAUTHENTICATED"; 2984 "SECURITY_STYLE_UNAUTHENTICATED";
2984 style_to_string[content::SECURITY_STYLE_AUTHENTICATION_BROKEN] = 2985 style_to_string[content::SECURITY_STYLE_AUTHENTICATION_BROKEN] =
2985 "SECURITY_STYLE_AUTHENTICATION_BROKEN"; 2986 "SECURITY_STYLE_AUTHENTICATION_BROKEN";
(...skipping 3697 matching lines...) Expand 10 before | Expand all | Expand 10 after
6683 6684
6684 Send(reply_message_); 6685 Send(reply_message_);
6685 redirect_query_ = 0; 6686 redirect_query_ = 0;
6686 reply_message_ = NULL; 6687 reply_message_ = NULL;
6687 } 6688 }
6688 6689
6689 void TestingAutomationProvider::OnRemoveProvider() { 6690 void TestingAutomationProvider::OnRemoveProvider() {
6690 if (g_browser_process) 6691 if (g_browser_process)
6691 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6692 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6692 } 6693 }
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/content_settings/tab_specific_content_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698