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

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

Issue 4194007: Revert "Refactor automation messages." due to mysterious problems on mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/message_box_flags.h" 7 #include "app/message_box_flags.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "chrome/common/chrome_constants.h" 58 #include "chrome/common/chrome_constants.h"
59 #include "chrome/common/chrome_paths.h" 59 #include "chrome/common/chrome_paths.h"
60 #include "chrome/common/chrome_switches.h" 60 #include "chrome/common/chrome_switches.h"
61 #include "chrome/common/net/url_request_context_getter.h" 61 #include "chrome/common/net/url_request_context_getter.h"
62 #include "chrome/common/notification_service.h" 62 #include "chrome/common/notification_service.h"
63 #include "chrome/common/url_constants.h" 63 #include "chrome/common/url_constants.h"
64 #include "chrome/browser/notifications/balloon.h" 64 #include "chrome/browser/notifications/balloon.h"
65 #include "chrome/browser/notifications/balloon_collection.h" 65 #include "chrome/browser/notifications/balloon_collection.h"
66 #include "chrome/browser/notifications/notification.h" 66 #include "chrome/browser/notifications/notification.h"
67 #include "chrome/browser/notifications/notification_ui_manager.h" 67 #include "chrome/browser/notifications/notification_ui_manager.h"
68 #include "chrome/common/automation_messages.h" 68 #include "chrome/test/automation/automation_messages.h"
69 #include "net/base/cookie_store.h" 69 #include "net/base/cookie_store.h"
70 #include "net/url_request/url_request_context.h" 70 #include "net/url_request/url_request_context.h"
71 #include "views/event.h" 71 #include "views/event.h"
72 #include "webkit/glue/plugins/plugin_list.h" 72 #include "webkit/glue/plugins/plugin_list.h"
73 73
74 namespace { 74 namespace {
75 75
76 class GetCookiesTask : public Task { 76 class GetCookiesTask : public Task {
77 public: 77 public:
78 GetCookiesTask(const GURL& url, 78 GetCookiesTask(const GURL& url,
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 *success = false; 1345 *success = false;
1346 *security_style = SECURITY_STYLE_UNKNOWN; 1346 *security_style = SECURITY_STYLE_UNKNOWN;
1347 *ssl_cert_status = 0; 1347 *ssl_cert_status = 0;
1348 *insecure_content_status = 0; 1348 *insecure_content_status = 0;
1349 } 1349 }
1350 } 1350 }
1351 1351
1352 void TestingAutomationProvider::GetPageType( 1352 void TestingAutomationProvider::GetPageType(
1353 int handle, 1353 int handle,
1354 bool* success, 1354 bool* success,
1355 PageType* page_type) { 1355 NavigationEntry::PageType* page_type) {
1356 if (tab_tracker_->ContainsHandle(handle)) { 1356 if (tab_tracker_->ContainsHandle(handle)) {
1357 NavigationController* tab = tab_tracker_->GetResource(handle); 1357 NavigationController* tab = tab_tracker_->GetResource(handle);
1358 NavigationEntry* entry = tab->GetActiveEntry(); 1358 NavigationEntry* entry = tab->GetActiveEntry();
1359 *page_type = entry->page_type(); 1359 *page_type = entry->page_type();
1360 *success = true; 1360 *success = true;
1361 // In order to return the proper result when an interstitial is shown and 1361 // In order to return the proper result when an interstitial is shown and
1362 // no navigation entry were created for it we need to ask the TabContents. 1362 // no navigation entry were created for it we need to ask the TabContents.
1363 if (*page_type == NORMAL_PAGE && 1363 if (*page_type == NavigationEntry::NORMAL_PAGE &&
1364 tab->tab_contents()->showing_interstitial_page()) 1364 tab->tab_contents()->showing_interstitial_page())
1365 *page_type = INTERSTITIAL_PAGE; 1365 *page_type = NavigationEntry::INTERSTITIAL_PAGE;
1366 } else { 1366 } else {
1367 *success = false; 1367 *success = false;
1368 *page_type = NORMAL_PAGE; 1368 *page_type = NavigationEntry::NORMAL_PAGE;
1369 } 1369 }
1370 } 1370 }
1371 1371
1372 void TestingAutomationProvider::GetMetricEventDuration( 1372 void TestingAutomationProvider::GetMetricEventDuration(
1373 const std::string& event_name, 1373 const std::string& event_name,
1374 int* duration_ms) { 1374 int* duration_ms) {
1375 *duration_ms = metric_event_duration_observer_->GetEventDurationMs( 1375 *duration_ms = metric_event_duration_observer_->GetEventDurationMs(
1376 event_name); 1376 event_name);
1377 } 1377 }
1378 1378
1379 void TestingAutomationProvider::ActionOnSSLBlockingPage( 1379 void TestingAutomationProvider::ActionOnSSLBlockingPage(
1380 int handle, 1380 int handle,
1381 bool proceed, 1381 bool proceed,
1382 IPC::Message* reply_message) { 1382 IPC::Message* reply_message) {
1383 if (tab_tracker_->ContainsHandle(handle)) { 1383 if (tab_tracker_->ContainsHandle(handle)) {
1384 NavigationController* tab = tab_tracker_->GetResource(handle); 1384 NavigationController* tab = tab_tracker_->GetResource(handle);
1385 NavigationEntry* entry = tab->GetActiveEntry(); 1385 NavigationEntry* entry = tab->GetActiveEntry();
1386 if (entry->page_type() == INTERSTITIAL_PAGE) { 1386 if (entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE) {
1387 TabContents* tab_contents = tab->tab_contents(); 1387 TabContents* tab_contents = tab->tab_contents();
1388 InterstitialPage* ssl_blocking_page = 1388 InterstitialPage* ssl_blocking_page =
1389 InterstitialPage::GetInterstitialPage(tab_contents); 1389 InterstitialPage::GetInterstitialPage(tab_contents);
1390 if (ssl_blocking_page) { 1390 if (ssl_blocking_page) {
1391 if (proceed) { 1391 if (proceed) {
1392 AddNavigationStatusListener(tab, reply_message, 1, false); 1392 AddNavigationStatusListener(tab, reply_message, 1, false);
1393 ssl_blocking_page->Proceed(); 1393 ssl_blocking_page->Proceed();
1394 return; 1394 return;
1395 } 1395 }
1396 ssl_blocking_page->DontProceed(); 1396 ssl_blocking_page->DontProceed();
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 2451
2452 NavigationEntry::SSLStatus ssl_status = nav_entry->ssl(); 2452 NavigationEntry::SSLStatus ssl_status = nav_entry->ssl();
2453 ssl->SetString("security_style", 2453 ssl->SetString("security_style",
2454 style_to_string[ssl_status.security_style()]); 2454 style_to_string[ssl_status.security_style()]);
2455 ssl->SetBoolean("ran_insecure_content", ssl_status.ran_insecure_content()); 2455 ssl->SetBoolean("ran_insecure_content", ssl_status.ran_insecure_content());
2456 ssl->SetBoolean("displayed_insecure_content", 2456 ssl->SetBoolean("displayed_insecure_content",
2457 ssl_status.displayed_insecure_content()); 2457 ssl_status.displayed_insecure_content());
2458 return_value->Set("ssl", ssl); 2458 return_value->Set("ssl", ssl);
2459 2459
2460 // Page type. 2460 // Page type.
2461 std::map<PageType, std::string> pagetype_to_string; 2461 std::map<NavigationEntry::PageType, std::string> pagetype_to_string;
2462 pagetype_to_string[NORMAL_PAGE] = "NORMAL_PAGE"; 2462 pagetype_to_string[NavigationEntry::NORMAL_PAGE] = "NORMAL_PAGE";
2463 pagetype_to_string[ERROR_PAGE] = "ERROR_PAGE"; 2463 pagetype_to_string[NavigationEntry::ERROR_PAGE] = "ERROR_PAGE";
2464 pagetype_to_string[INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE"; 2464 pagetype_to_string[NavigationEntry::INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE";
2465 return_value->SetString("page_type", 2465 return_value->SetString("page_type",
2466 pagetype_to_string[nav_entry->page_type()]); 2466 pagetype_to_string[nav_entry->page_type()]);
2467 2467
2468 return_value->SetString("favicon_url", nav_entry->favicon().url().spec()); 2468 return_value->SetString("favicon_url", nav_entry->favicon().url().spec());
2469 reply.SendSuccess(return_value.get()); 2469 reply.SendSuccess(return_value.get());
2470 } 2470 }
2471 2471
2472 // Sample json input: { "command": "GetHistoryInfo", 2472 // Sample json input: { "command": "GetHistoryInfo",
2473 // "search_text": "some text" } 2473 // "search_text": "some text" }
2474 // Refer chrome/test/pyautolib/history_info.py for sample json output. 2474 // Refer chrome/test/pyautolib/history_info.py for sample json output.
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
4211 DCHECK(type == NotificationType::SESSION_END); 4211 DCHECK(type == NotificationType::SESSION_END);
4212 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit 4212 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit
4213 // before the task runs resulting in this object not being deleted. This 4213 // before the task runs resulting in this object not being deleted. This
4214 // Release balance out the Release scheduled by OnBrowserRemoved. 4214 // Release balance out the Release scheduled by OnBrowserRemoved.
4215 Release(); 4215 Release();
4216 } 4216 }
4217 4217
4218 void TestingAutomationProvider::OnRemoveProvider() { 4218 void TestingAutomationProvider::OnRemoveProvider() {
4219 AutomationProviderList::GetInstance()->RemoveProvider(this); 4219 AutomationProviderList::GetInstance()->RemoveProvider(this);
4220 } 4220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698