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

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

Issue 63033: Refactor AppModalDialogQueue and move JS Alert boxes into a MVC. (Closed)
Patch Set: whitespace Created 11 years, 8 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_win.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-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
11 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
12 #include "chrome/browser/app_modal_dialog.h"
12 #include "chrome/browser/automation/automation_provider_list.h" 13 #include "chrome/browser/automation/automation_provider_list.h"
13 #include "chrome/browser/automation/url_request_failed_dns_job.h" 14 #include "chrome/browser/automation/url_request_failed_dns_job.h"
14 #include "chrome/browser/automation/url_request_mock_http_job.h" 15 #include "chrome/browser/automation/url_request_mock_http_job.h"
15 #include "chrome/browser/automation/url_request_slow_download_job.h" 16 #include "chrome/browser/automation/url_request_slow_download_job.h"
16 #include "chrome/browser/browser_window.h" 17 #include "chrome/browser/browser_window.h"
17 #include "chrome/browser/dom_operation_notification_details.h" 18 #include "chrome/browser/dom_operation_notification_details.h"
18 #include "chrome/browser/download/download_manager.h" 19 #include "chrome/browser/download/download_manager.h"
19 #include "chrome/browser/find_bar.h" 20 #include "chrome/browser/find_bar.h"
20 #include "chrome/browser/find_bar_controller.h" 21 #include "chrome/browser/find_bar_controller.h"
21 #include "chrome/browser/find_notification_details.h" 22 #include "chrome/browser/find_notification_details.h"
(...skipping 14 matching lines...) Expand all
36 // TODO(port): Port these headers. 37 // TODO(port): Port these headers.
37 #include "chrome/browser/app_modal_dialog_queue.h" 38 #include "chrome/browser/app_modal_dialog_queue.h"
38 #include "chrome/browser/automation/ui_controls.h" 39 #include "chrome/browser/automation/ui_controls.h"
39 #include "chrome/browser/character_encoding.h" 40 #include "chrome/browser/character_encoding.h"
40 #include "chrome/browser/download/save_package.h" 41 #include "chrome/browser/download/save_package.h"
41 #include "chrome/browser/external_tab_container.h" 42 #include "chrome/browser/external_tab_container.h"
42 #include "chrome/browser/login_prompt.h" 43 #include "chrome/browser/login_prompt.h"
43 #include "chrome/browser/printing/print_job.h" 44 #include "chrome/browser/printing/print_job.h"
44 #include "chrome/browser/views/bookmark_bar_view.h" 45 #include "chrome/browser/views/bookmark_bar_view.h"
45 #include "chrome/browser/views/location_bar_view.h" 46 #include "chrome/browser/views/location_bar_view.h"
46 #include "chrome/views/window/app_modal_dialog_delegate.h" 47 #include "chrome/views/window/dialog_delegate.h"
47 #include "chrome/views/window/window.h" 48 #include "chrome/views/window/window.h"
48 #endif // defined(OS_WIN) 49 #endif // defined(OS_WIN)
49 50
50 using base::Time; 51 using base::Time;
51 52
52 class InitialLoadObserver : public NotificationObserver { 53 class InitialLoadObserver : public NotificationObserver {
53 public: 54 public:
54 InitialLoadObserver(size_t tab_count, AutomationProvider* automation) 55 InitialLoadObserver(size_t tab_count, AutomationProvider* automation)
55 : automation_(automation), 56 : automation_(automation),
56 outstanding_tab_count_(tab_count) { 57 outstanding_tab_count_(tab_count) {
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 } 1221 }
1221 1222
1222 void AutomationProvider::GetBrowserWindowCount(int* window_count) { 1223 void AutomationProvider::GetBrowserWindowCount(int* window_count) {
1223 *window_count = static_cast<int>(BrowserList::size()); 1224 *window_count = static_cast<int>(BrowserList::size());
1224 } 1225 }
1225 1226
1226 #if defined(OS_WIN) 1227 #if defined(OS_WIN)
1227 // TODO(port): Enable when dialog delegate is ported. 1228 // TODO(port): Enable when dialog delegate is ported.
1228 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, 1229 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog,
1229 int* dialog_button) { 1230 int* dialog_button) {
1230 views::AppModalDialogDelegate* dialog_delegate = 1231 AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog();
1231 AppModalDialogQueue::active_dialog();
1232 *showing_dialog = (dialog_delegate != NULL); 1232 *showing_dialog = (dialog_delegate != NULL);
1233 if (*showing_dialog) 1233 if (*showing_dialog)
1234 *dialog_button = dialog_delegate->GetDialogButtons(); 1234 *dialog_button = dialog_delegate->GetDialogButtons();
1235 else 1235 else
1236 *dialog_button = views::DialogDelegate::DIALOGBUTTON_NONE; 1236 *dialog_button = views::DialogDelegate::DIALOGBUTTON_NONE;
1237 } 1237 }
1238 1238
1239 void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) { 1239 void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) {
1240 *success = false; 1240 *success = false;
1241 1241
1242 views::AppModalDialogDelegate* dialog_delegate = 1242 AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog();
1243 AppModalDialogQueue::active_dialog();
1244 if (dialog_delegate && 1243 if (dialog_delegate &&
1245 (dialog_delegate->GetDialogButtons() & button) == button) { 1244 (dialog_delegate->GetDialogButtons() & button) == button) {
1246 views::DialogClientView* client_view =
1247 dialog_delegate->window()->GetClientView()->AsDialogClientView();
1248 if ((button & views::DialogDelegate::DIALOGBUTTON_OK) == 1245 if ((button & views::DialogDelegate::DIALOGBUTTON_OK) ==
1249 views::DialogDelegate::DIALOGBUTTON_OK) { 1246 views::DialogDelegate::DIALOGBUTTON_OK) {
1250 client_view->AcceptWindow(); 1247 dialog_delegate->AcceptWindow();
1251 *success = true; 1248 *success = true;
1252 } 1249 }
1253 if ((button & views::DialogDelegate::DIALOGBUTTON_CANCEL) == 1250 if ((button & views::DialogDelegate::DIALOGBUTTON_CANCEL) ==
1254 views::DialogDelegate::DIALOGBUTTON_CANCEL) { 1251 views::DialogDelegate::DIALOGBUTTON_CANCEL) {
1255 DCHECK(!*success) << "invalid param, OK and CANCEL specified"; 1252 DCHECK(!*success) << "invalid param, OK and CANCEL specified";
1256 client_view->CancelWindow(); 1253 dialog_delegate->CancelWindow();
1257 *success = true; 1254 *success = true;
1258 } 1255 }
1259 } 1256 }
1260 } 1257 }
1261 #endif 1258 #endif
1262 1259
1263 void AutomationProvider::GetBrowserWindow(int index, int* handle) { 1260 void AutomationProvider::GetBrowserWindow(int index, int* handle) {
1264 *handle = 0; 1261 *handle = 0;
1265 if (index >= 0) { 1262 if (index >= 0) {
1266 BrowserList::const_iterator iter = BrowserList::begin(); 1263 BrowserList::const_iterator iter = BrowserList::begin();
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 if (!SetParent(params.window, params.parent_window)) 2773 if (!SetParent(params.window, params.parent_window))
2777 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); 2774 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError();
2778 } 2775 }
2779 } 2776 }
2780 2777
2781 SetWindowPos(params.window, params.window_insert_after, params.left, 2778 SetWindowPos(params.window, params.window_insert_after, params.left,
2782 params.top, params.width, params.height, params.flags); 2779 params.top, params.width, params.height, params.flags);
2783 } 2780 }
2784 2781
2785 #endif // defined(OS_WIN) 2782 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « chrome/browser/app_modal_dialog_win.cc ('k') | chrome/browser/browser.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698