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

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

Issue 27080: AppModalDialogQueue shouldn't depend on views. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « chrome/browser/app_modal_dialog_queue_unittest.cc ('k') | chrome/browser/browser.vcproj » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/automation_provider.h" 5 #include "chrome/browser/automation/automation_provider.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
11 #include "chrome/browser/app_modal_dialog_delegate.h"
11 #include "chrome/browser/app_modal_dialog_queue.h" 12 #include "chrome/browser/app_modal_dialog_queue.h"
12 #include "chrome/browser/automation/automation_provider_list.h" 13 #include "chrome/browser/automation/automation_provider_list.h"
13 #include "chrome/browser/automation/ui_controls.h" 14 #include "chrome/browser/automation/ui_controls.h"
14 #include "chrome/browser/automation/url_request_failed_dns_job.h" 15 #include "chrome/browser/automation/url_request_failed_dns_job.h"
15 #include "chrome/browser/automation/url_request_mock_http_job.h" 16 #include "chrome/browser/automation/url_request_mock_http_job.h"
16 #include "chrome/browser/automation/url_request_slow_download_job.h" 17 #include "chrome/browser/automation/url_request_slow_download_job.h"
17 #include "chrome/browser/browser_window.h" 18 #include "chrome/browser/browser_window.h"
18 #include "chrome/browser/character_encoding.h" 19 #include "chrome/browser/character_encoding.h"
19 #include "chrome/browser/dom_operation_notification_details.h" 20 #include "chrome/browser/dom_operation_notification_details.h"
20 #include "chrome/browser/download/download_manager.h" 21 #include "chrome/browser/download/download_manager.h"
21 #include "chrome/browser/download/save_package.h" 22 #include "chrome/browser/download/save_package.h"
22 #include "chrome/browser/external_tab_container.h" 23 #include "chrome/browser/external_tab_container.h"
23 #include "chrome/browser/find_notification_details.h" 24 #include "chrome/browser/find_notification_details.h"
24 #include "chrome/browser/login_prompt.h" 25 #include "chrome/browser/login_prompt.h"
25 #include "chrome/browser/printing/print_job.h" 26 #include "chrome/browser/printing/print_job.h"
26 #include "chrome/browser/renderer_host/render_view_host.h" 27 #include "chrome/browser/renderer_host/render_view_host.h"
27 #include "chrome/browser/ssl/ssl_manager.h" 28 #include "chrome/browser/ssl/ssl_manager.h"
28 #include "chrome/browser/ssl/ssl_blocking_page.h" 29 #include "chrome/browser/ssl/ssl_blocking_page.h"
29 #include "chrome/browser/tab_contents/web_contents.h" 30 #include "chrome/browser/tab_contents/web_contents.h"
30 #include "chrome/browser/tab_contents/web_contents_view.h" 31 #include "chrome/browser/tab_contents/web_contents_view.h"
31 #include "chrome/browser/views/bookmark_bar_view.h" 32 #include "chrome/browser/views/bookmark_bar_view.h"
32 #include "chrome/browser/views/location_bar_view.h" 33 #include "chrome/browser/views/location_bar_view.h"
33 #include "chrome/common/chrome_paths.h" 34 #include "chrome/common/chrome_paths.h"
34 #include "chrome/common/notification_registrar.h" 35 #include "chrome/common/notification_registrar.h"
35 #include "chrome/common/pref_service.h" 36 #include "chrome/common/pref_service.h"
36 #include "chrome/views/app_modal_dialog_delegate.h" 37 #include "chrome/views/dialog_delegate.h"
37 #include "chrome/views/window.h" 38 #include "chrome/views/window.h"
38 #include "chrome/test/automation/automation_messages.h" 39 #include "chrome/test/automation/automation_messages.h"
39 #include "net/base/cookie_monster.h" 40 #include "net/base/cookie_monster.h"
40 #include "net/url_request/url_request_context.h" 41 #include "net/url_request/url_request_context.h"
41 #include "net/url_request/url_request_filter.h" 42 #include "net/url_request/url_request_filter.h"
42 43
43 using base::Time; 44 using base::Time;
44 45
45 class InitialLoadObserver : public NotificationObserver { 46 class InitialLoadObserver : public NotificationObserver {
46 public: 47 public:
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 *active_tab_index = browser->selected_index(); 1156 *active_tab_index = browser->selected_index();
1156 } 1157 }
1157 } 1158 }
1158 1159
1159 void AutomationProvider::GetBrowserWindowCount(int* window_count) { 1160 void AutomationProvider::GetBrowserWindowCount(int* window_count) {
1160 *window_count = static_cast<int>(BrowserList::size()); 1161 *window_count = static_cast<int>(BrowserList::size());
1161 } 1162 }
1162 1163
1163 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, 1164 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog,
1164 int* dialog_button) { 1165 int* dialog_button) {
1165 views::AppModalDialogDelegate* dialog_delegate = 1166 *showing_dialog = AppModalDialogQueue::HasActiveDialog();
1166 AppModalDialogQueue::active_dialog(); 1167 *dialog_button = views::DialogDelegate::DIALOGBUTTON_NONE;
1167 *showing_dialog = (dialog_delegate != NULL); 1168 if (!*showing_dialog)
1168 if (*showing_dialog) 1169 return;
1169 *dialog_button = dialog_delegate->GetDialogButtons(); 1170
1170 else 1171 views::DialogDelegate* dialog_delegate =
1171 *dialog_button = views::DialogDelegate::DIALOGBUTTON_NONE; 1172 AppModalDialogQueue::active_dialog()->GetTestingInterface()->
1173 GetDialogDelegate();
1174 *dialog_button = dialog_delegate->GetDialogButtons();
1172 } 1175 }
1173 1176
1174 void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) { 1177 void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) {
1175 *success = false; 1178 *success = false;
1179 if (!AppModalDialogQueue::HasActiveDialog())
1180 return;
1176 1181
1177 views::AppModalDialogDelegate* dialog_delegate = 1182 views::DialogDelegate* dialog_delegate =
1178 AppModalDialogQueue::active_dialog(); 1183 AppModalDialogQueue::active_dialog()->GetTestingInterface()->
1179 if (dialog_delegate && 1184 GetDialogDelegate();
1180 (dialog_delegate->GetDialogButtons() & button) == button) { 1185 if ((dialog_delegate->GetDialogButtons() & button) == button) {
1181 views::DialogClientView* client_view = 1186 views::DialogClientView* client_view =
1182 dialog_delegate->window()->client_view()->AsDialogClientView(); 1187 dialog_delegate->window()->client_view()->AsDialogClientView();
1183 if ((button & views::DialogDelegate::DIALOGBUTTON_OK) == 1188 if ((button & views::DialogDelegate::DIALOGBUTTON_OK) ==
1184 views::DialogDelegate::DIALOGBUTTON_OK) { 1189 views::DialogDelegate::DIALOGBUTTON_OK) {
1185 client_view->AcceptWindow(); 1190 client_view->AcceptWindow();
1186 *success = true; 1191 *success = true;
1187 } 1192 }
1188 if ((button & views::DialogDelegate::DIALOGBUTTON_CANCEL) == 1193 if ((button & views::DialogDelegate::DIALOGBUTTON_CANCEL) ==
1189 views::DialogDelegate::DIALOGBUTTON_CANCEL) { 1194 views::DialogDelegate::DIALOGBUTTON_CANCEL) {
1190 DCHECK(!*success) << "invalid param, OK and CANCEL specified"; 1195 DCHECK(!*success) << "invalid param, OK and CANCEL specified";
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 browser->OverrideEncoding(selected_encoding_id); 2597 browser->OverrideEncoding(selected_encoding_id);
2593 *success = true; 2598 *success = true;
2594 } 2599 }
2595 } 2600 }
2596 } 2601 }
2597 } 2602 }
2598 2603
2599 void AutomationProvider::SavePackageShouldPromptUser(bool should_prompt) { 2604 void AutomationProvider::SavePackageShouldPromptUser(bool should_prompt) {
2600 SavePackage::SetShouldPromptUser(should_prompt); 2605 SavePackage::SetShouldPromptUser(should_prompt);
2601 } 2606 }
OLDNEW
« no previous file with comments | « chrome/browser/app_modal_dialog_queue_unittest.cc ('k') | chrome/browser/browser.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698