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

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

Issue 8892011: Clean up TCW, make it solely a hub for 1:1 observer/helper objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #include "chrome/common/extensions/extension.h" 111 #include "chrome/common/extensions/extension.h"
112 #include "chrome/common/extensions/extension_action.h" 112 #include "chrome/common/extensions/extension_action.h"
113 #include "chrome/common/extensions/url_pattern.h" 113 #include "chrome/common/extensions/url_pattern.h"
114 #include "chrome/common/extensions/url_pattern_set.h" 114 #include "chrome/common/extensions/url_pattern_set.h"
115 #include "chrome/common/pref_names.h" 115 #include "chrome/common/pref_names.h"
116 #include "chrome/common/render_messages.h" 116 #include "chrome/common/render_messages.h"
117 #include "chrome/common/url_constants.h" 117 #include "chrome/common/url_constants.h"
118 #include "content/browser/plugin_service.h" 118 #include "content/browser/plugin_service.h"
119 #include "content/browser/renderer_host/render_view_host.h" 119 #include "content/browser/renderer_host/render_view_host.h"
120 #include "content/browser/tab_contents/interstitial_page.h" 120 #include "content/browser/tab_contents/interstitial_page.h"
121 #include "content/browser/tab_contents/tab_contents.h"
121 #include "content/public/browser/notification_service.h" 122 #include "content/public/browser/notification_service.h"
122 #include "content/public/browser/render_process_host.h" 123 #include "content/public/browser/render_process_host.h"
123 #include "content/public/common/child_process_host.h" 124 #include "content/public/common/child_process_host.h"
124 #include "content/public/common/common_param_traits.h" 125 #include "content/public/common/common_param_traits.h"
125 #include "net/base/cookie_store.h" 126 #include "net/base/cookie_store.h"
126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
127 #include "ui/base/events.h" 128 #include "ui/base/events.h"
128 #include "ui/base/keycodes/keyboard_codes.h" 129 #include "ui/base/keycodes/keyboard_codes.h"
129 #include "ui/base/ui_base_types.h" 130 #include "ui/base/ui_base_types.h"
130 #include "webkit/glue/webdropdata.h" 131 #include "webkit/glue/webdropdata.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 int append_tab_response = -1; // -1 is the error code 520 int append_tab_response = -1; // -1 is the error code
520 content::NotificationObserver* observer = NULL; 521 content::NotificationObserver* observer = NULL;
521 522
522 if (browser_tracker_->ContainsHandle(handle)) { 523 if (browser_tracker_->ContainsHandle(handle)) {
523 Browser* browser = browser_tracker_->GetResource(handle); 524 Browser* browser = browser_tracker_->GetResource(handle);
524 observer = new TabAppendedNotificationObserver(browser, this, 525 observer = new TabAppendedNotificationObserver(browser, this,
525 reply_message); 526 reply_message);
526 TabContentsWrapper* contents = 527 TabContentsWrapper* contents =
527 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); 528 browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
528 if (contents) { 529 if (contents) {
529 append_tab_response = 530 append_tab_response = GetIndexForNavigationController(
530 GetIndexForNavigationController(&contents->controller(), browser); 531 &contents->tab_contents()->controller(), browser);
531 } 532 }
532 } 533 }
533 534
534 if (append_tab_response < 0) { 535 if (append_tab_response < 0) {
535 // Appending tab failed. Clean up and send failure response. 536 // Appending tab failed. Clean up and send failure response.
536 537
537 if (observer) 538 if (observer)
538 delete observer; 539 delete observer;
539 540
540 AutomationMsg_AppendTab::WriteReplyParams(reply_message, 541 AutomationMsg_AppendTab::WriteReplyParams(reply_message,
(...skipping 4263 matching lines...) Expand 10 before | Expand all | Expand 10 after
4804 new AutofillFormSubmittedObserver(this, reply_message, pdm); 4805 new AutofillFormSubmittedObserver(this, reply_message, pdm);
4805 4806
4806 // Set the routing id of this message with the controller. 4807 // Set the routing id of this message with the controller.
4807 // This routing id needs to be remembered for the reverse 4808 // This routing id needs to be remembered for the reverse
4808 // communication while sending back the response of 4809 // communication while sending back the response of
4809 // this javascript execution. 4810 // this javascript execution.
4810 std::string set_automation_id; 4811 std::string set_automation_id;
4811 base::SStringPrintf(&set_automation_id, 4812 base::SStringPrintf(&set_automation_id,
4812 "window.domAutomationController.setAutomationId(%d);", 4813 "window.domAutomationController.setAutomationId(%d);",
4813 reply_message->routing_id()); 4814 reply_message->routing_id());
4814 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( 4815 tab_contents->tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame(
4815 frame_xpath, UTF8ToUTF16(set_automation_id)); 4816 frame_xpath, UTF8ToUTF16(set_automation_id));
4816 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( 4817 tab_contents->tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame(
4817 frame_xpath, javascript); 4818 frame_xpath, javascript);
4818 } 4819 }
4819 4820
4820 void TestingAutomationProvider::AutofillTriggerSuggestions( 4821 void TestingAutomationProvider::AutofillTriggerSuggestions(
4821 Browser* browser, 4822 Browser* browser,
4822 DictionaryValue* args, 4823 DictionaryValue* args,
4823 IPC::Message* reply_message) { 4824 IPC::Message* reply_message) {
4824 int tab_index; 4825 int tab_index;
4825 if (!args->GetInteger("tab_index", &tab_index)) { 4826 if (!args->GetInteger("tab_index", &tab_index)) {
4826 AutomationJSONReply(this, reply_message).SendError( 4827 AutomationJSONReply(this, reply_message).SendError(
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
6646 6647
6647 Send(reply_message_); 6648 Send(reply_message_);
6648 redirect_query_ = 0; 6649 redirect_query_ = 0;
6649 reply_message_ = NULL; 6650 reply_message_ = NULL;
6650 } 6651 }
6651 6652
6652 void TestingAutomationProvider::OnRemoveProvider() { 6653 void TestingAutomationProvider::OnRemoveProvider() {
6653 if (g_browser_process) 6654 if (g_browser_process)
6654 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6655 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6655 } 6656 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698