Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 #include "chrome/browser/themes/theme_service_factory.h" | 79 #include "chrome/browser/themes/theme_service_factory.h" |
| 80 #include "chrome/browser/translate/translate_infobar_delegate.h" | 80 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| 81 #include "chrome/browser/translate/translate_tab_helper.h" | 81 #include "chrome/browser/translate/translate_tab_helper.h" |
| 82 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 82 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 83 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 83 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
| 84 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 84 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
| 85 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 85 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
| 86 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 86 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 87 #include "chrome/browser/ui/browser_init.h" | 87 #include "chrome/browser/ui/browser_init.h" |
| 88 #include "chrome/browser/ui/browser_window.h" | 88 #include "chrome/browser/ui/browser_window.h" |
| 89 #include "chrome/browser/ui/constrained_window_tab_helper.h" | |
| 89 #include "chrome/browser/ui/find_bar/find_bar.h" | 90 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 90 #include "chrome/browser/ui/login/login_prompt.h" | 91 #include "chrome/browser/ui/login/login_prompt.h" |
| 91 #include "chrome/browser/ui/omnibox/location_bar.h" | 92 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 92 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 93 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 93 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 94 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
| 94 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 95 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 95 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" | 96 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 96 #include "chrome/common/automation_messages.h" | 97 #include "chrome/common/automation_messages.h" |
| 97 #include "chrome/common/chrome_constants.h" | 98 #include "chrome/common/chrome_constants.h" |
| 98 #include "chrome/common/chrome_notification_types.h" | 99 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1349 WideToUTF16Hack(script), reply_message, | 1350 WideToUTF16Hack(script), reply_message, |
| 1350 tab_contents->render_view_host()); | 1351 tab_contents->render_view_host()); |
| 1351 } | 1352 } |
| 1352 | 1353 |
| 1353 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, | 1354 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, |
| 1354 int* count) { | 1355 int* count) { |
| 1355 *count = -1; // -1 is the error code | 1356 *count = -1; // -1 is the error code |
| 1356 if (tab_tracker_->ContainsHandle(handle)) { | 1357 if (tab_tracker_->ContainsHandle(handle)) { |
| 1357 NavigationController* nav_controller = tab_tracker_->GetResource(handle); | 1358 NavigationController* nav_controller = tab_tracker_->GetResource(handle); |
| 1358 TabContents* tab_contents = nav_controller->tab_contents(); | 1359 TabContents* tab_contents = nav_controller->tab_contents(); |
| 1359 if (tab_contents) | 1360 if (tab_contents) { |
| 1360 *count = static_cast<int>(tab_contents->child_windows_.size()); | 1361 TabContentsWrapper* wrapper = |
| 1362 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | |
| 1363 if (wrapper) | |
|
Avi (use Gerrit)
2011/09/29 18:30:36
braces around content of if when it spans more tha
| |
| 1364 *count = static_cast<int>(wrapper->constrained_window_tab_helper()-> | |
| 1365 constrained_window_count()); | |
| 1366 } | |
| 1361 } | 1367 } |
| 1362 } | 1368 } |
| 1363 | 1369 |
| 1364 void TestingAutomationProvider::HandleInspectElementRequest( | 1370 void TestingAutomationProvider::HandleInspectElementRequest( |
| 1365 int handle, int x, int y, IPC::Message* reply_message) { | 1371 int handle, int x, int y, IPC::Message* reply_message) { |
| 1366 TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); | 1372 TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); |
| 1367 if (tab_contents) { | 1373 if (tab_contents) { |
| 1368 DCHECK(!reply_message_); | 1374 DCHECK(!reply_message_); |
| 1369 reply_message_ = reply_message; | 1375 reply_message_ = reply_message; |
| 1370 | 1376 |
| (...skipping 5013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6384 | 6390 |
| 6385 Send(reply_message_); | 6391 Send(reply_message_); |
| 6386 redirect_query_ = 0; | 6392 redirect_query_ = 0; |
| 6387 reply_message_ = NULL; | 6393 reply_message_ = NULL; |
| 6388 } | 6394 } |
| 6389 | 6395 |
| 6390 void TestingAutomationProvider::OnRemoveProvider() { | 6396 void TestingAutomationProvider::OnRemoveProvider() { |
| 6391 if (g_browser_process) | 6397 if (g_browser_process) |
| 6392 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6398 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6393 } | 6399 } |
| OLD | NEW |