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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #include "chrome/browser/translate/translate_infobar_delegate.h" | 97 #include "chrome/browser/translate/translate_infobar_delegate.h" |
98 #include "chrome/browser/translate/translate_tab_helper.h" | 98 #include "chrome/browser/translate/translate_tab_helper.h" |
99 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 99 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
100 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 100 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
101 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" | 101 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" |
102 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 102 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
103 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 103 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
104 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 104 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
105 #include "chrome/browser/ui/browser_commands.h" | 105 #include "chrome/browser/ui/browser_commands.h" |
106 #include "chrome/browser/ui/browser_finder.h" | 106 #include "chrome/browser/ui/browser_finder.h" |
| 107 #include "chrome/browser/ui/browser_instant_controller.h" |
107 #include "chrome/browser/ui/browser_list.h" | 108 #include "chrome/browser/ui/browser_list.h" |
108 #include "chrome/browser/ui/browser_tabstrip.h" | 109 #include "chrome/browser/ui/browser_tabstrip.h" |
109 #include "chrome/browser/ui/browser_window.h" | 110 #include "chrome/browser/ui/browser_window.h" |
110 #include "chrome/browser/ui/extensions/application_launch.h" | 111 #include "chrome/browser/ui/extensions/application_launch.h" |
111 #include "chrome/browser/ui/find_bar/find_bar.h" | 112 #include "chrome/browser/ui/find_bar/find_bar.h" |
112 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 113 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
113 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | 114 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
114 #include "chrome/browser/ui/login/login_prompt.h" | 115 #include "chrome/browser/ui/login/login_prompt.h" |
115 #include "chrome/browser/ui/media_stream_infobar_delegate.h" | 116 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
116 #include "chrome/browser/ui/omnibox/location_bar.h" | 117 #include "chrome/browser/ui/omnibox/location_bar.h" |
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3231 } | 3232 } |
3232 new OmniboxAcceptNotificationObserver(&controller, this, reply_message); | 3233 new OmniboxAcceptNotificationObserver(&controller, this, reply_message); |
3233 loc_bar->AcceptInput(); | 3234 loc_bar->AcceptInput(); |
3234 } | 3235 } |
3235 | 3236 |
3236 // Sample json input: { "command": "GetInstantInfo" } | 3237 // Sample json input: { "command": "GetInstantInfo" } |
3237 void TestingAutomationProvider::GetInstantInfo(Browser* browser, | 3238 void TestingAutomationProvider::GetInstantInfo(Browser* browser, |
3238 DictionaryValue* args, | 3239 DictionaryValue* args, |
3239 IPC::Message* reply_message) { | 3240 IPC::Message* reply_message) { |
3240 DictionaryValue* info = new DictionaryValue; | 3241 DictionaryValue* info = new DictionaryValue; |
3241 if (browser->instant()) { | 3242 if (browser->instant_controller()->instant()) { |
3242 InstantController* instant = browser->instant(); | 3243 InstantController* instant = browser->instant_controller()->instant(); |
3243 info->SetBoolean("enabled", true); | 3244 info->SetBoolean("enabled", true); |
3244 info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); | 3245 info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); |
3245 info->SetBoolean("current", instant->IsCurrent()); | 3246 info->SetBoolean("current", instant->IsCurrent()); |
3246 if (instant->GetPreviewContents() && | 3247 if (instant->GetPreviewContents() && |
3247 instant->GetPreviewContents()->web_contents()) { | 3248 instant->GetPreviewContents()->web_contents()) { |
3248 WebContents* contents = instant->GetPreviewContents()->web_contents(); | 3249 WebContents* contents = instant->GetPreviewContents()->web_contents(); |
3249 info->SetBoolean("loading", contents->IsLoading()); | 3250 info->SetBoolean("loading", contents->IsLoading()); |
3250 info->SetString("location", contents->GetURL().spec()); | 3251 info->SetString("location", contents->GetURL().spec()); |
3251 info->SetString("title", contents->GetTitle()); | 3252 info->SetString("title", contents->GetTitle()); |
3252 } | 3253 } |
(...skipping 3517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6770 void TestingAutomationProvider::OnRemoveProvider() { | 6771 void TestingAutomationProvider::OnRemoveProvider() { |
6771 if (g_browser_process) | 6772 if (g_browser_process) |
6772 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6773 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6773 } | 6774 } |
6774 | 6775 |
6775 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6776 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6776 WebContents* tab) { | 6777 WebContents* tab) { |
6777 if (chrome::GetActiveWebContents(browser) != tab) | 6778 if (chrome::GetActiveWebContents(browser) != tab) |
6778 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6779 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
6779 } | 6780 } |
OLD | NEW |