OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <set> | 7 #include <set> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/automation/automation_extension_function.h" | 26 #include "chrome/browser/automation/automation_extension_function.h" |
27 #include "chrome/browser/automation/automation_provider_list.h" | 27 #include "chrome/browser/automation/automation_provider_list.h" |
28 #include "chrome/browser/automation/automation_provider_observers.h" | 28 #include "chrome/browser/automation/automation_provider_observers.h" |
29 #include "chrome/browser/automation/extension_automation_constants.h" | 29 #include "chrome/browser/automation/extension_automation_constants.h" |
30 #include "chrome/browser/automation/extension_port_container.h" | 30 #include "chrome/browser/automation/extension_port_container.h" |
31 #include "chrome/browser/blocked_popup_container.h" | 31 #include "chrome/browser/blocked_popup_container.h" |
32 #include "chrome/browser/bookmarks/bookmark_model.h" | 32 #include "chrome/browser/bookmarks/bookmark_model.h" |
33 #include "chrome/browser/bookmarks/bookmark_storage.h" | 33 #include "chrome/browser/bookmarks/bookmark_storage.h" |
34 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
35 #include "chrome/browser/browser_window.h" | 35 #include "chrome/browser/browser_window.h" |
| 36 #include "chrome/browser/browsing_data_remover.h" |
36 #include "chrome/browser/chrome_thread.h" | 37 #include "chrome/browser/chrome_thread.h" |
37 #include "chrome/browser/dom_operation_notification_details.h" | 38 #include "chrome/browser/dom_operation_notification_details.h" |
38 #include "chrome/browser/debugger/devtools_manager.h" | 39 #include "chrome/browser/debugger/devtools_manager.h" |
39 #include "chrome/browser/download/download_manager.h" | 40 #include "chrome/browser/download/download_manager.h" |
40 #include "chrome/browser/download/download_shelf.h" | 41 #include "chrome/browser/download/download_shelf.h" |
41 #include "chrome/browser/extensions/crx_installer.h" | 42 #include "chrome/browser/extensions/crx_installer.h" |
42 #include "chrome/browser/extensions/extension_install_ui.h" | 43 #include "chrome/browser/extensions/extension_install_ui.h" |
43 #include "chrome/browser/extensions/extension_message_service.h" | 44 #include "chrome/browser/extensions/extension_message_service.h" |
44 #include "chrome/browser/extensions/user_script_master.h" | 45 #include "chrome/browser/extensions/user_script_master.h" |
45 #include "chrome/browser/find_bar.h" | 46 #include "chrome/browser/find_bar.h" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 LoginWithUserAndPass) | 500 LoginWithUserAndPass) |
500 #endif | 501 #endif |
501 #if defined(TOOLKIT_VIEWS) | 502 #if defined(TOOLKIT_VIEWS) |
502 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForFocusedViewIDToChange, | 503 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForFocusedViewIDToChange, |
503 WaitForFocusedViewIDToChange) | 504 WaitForFocusedViewIDToChange) |
504 IPC_MESSAGE_HANDLER(AutomationMsg_StartTrackingPopupMenus, | 505 IPC_MESSAGE_HANDLER(AutomationMsg_StartTrackingPopupMenus, |
505 StartTrackingPopupMenus) | 506 StartTrackingPopupMenus) |
506 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForPopupMenuToOpen, | 507 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForPopupMenuToOpen, |
507 WaitForPopupMenuToOpen) | 508 WaitForPopupMenuToOpen) |
508 #endif | 509 #endif |
| 510 IPC_MESSAGE_HANDLER(AutomationMsg_RemoveBrowsingData, RemoveBrowsingData) |
509 IPC_END_MESSAGE_MAP() | 511 IPC_END_MESSAGE_MAP() |
510 } | 512 } |
511 | 513 |
512 void AutomationProvider::ActivateTab(int handle, int at_index, int* status) { | 514 void AutomationProvider::ActivateTab(int handle, int at_index, int* status) { |
513 *status = -1; | 515 *status = -1; |
514 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 516 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { |
515 Browser* browser = browser_tracker_->GetResource(handle); | 517 Browser* browser = browser_tracker_->GetResource(handle); |
516 if (at_index >= 0 && at_index < browser->tab_count()) { | 518 if (at_index >= 0 && at_index < browser->tab_count()) { |
517 browser->SelectTabContentsAt(at_index, true); | 519 browser->SelectTabContentsAt(at_index, true); |
518 *status = 0; | 520 *status = 0; |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 NavigationController* tab = tab_tracker_->GetResource(tab_handle); | 2344 NavigationController* tab = tab_tracker_->GetResource(tab_handle); |
2343 DCHECK(tab != NULL); | 2345 DCHECK(tab != NULL); |
2344 if (tab && tab->tab_contents()) { | 2346 if (tab && tab->tab_contents()) { |
2345 DCHECK(tab->tab_contents()->profile() != NULL); | 2347 DCHECK(tab->tab_contents()->profile() != NULL); |
2346 tab->tab_contents()->profile()->GetPrefs()->SetInteger( | 2348 tab->tab_contents()->profile()->GetPrefs()->SetInteger( |
2347 prefs::kWebKitDefaultFontSize, font_size); | 2349 prefs::kWebKitDefaultFontSize, font_size); |
2348 } | 2350 } |
2349 } | 2351 } |
2350 } | 2352 } |
2351 | 2353 |
| 2354 void AutomationProvider::RemoveBrowsingData(int remove_mask) { |
| 2355 BrowsingDataRemover* remover; |
| 2356 remover = new BrowsingDataRemover(profile(), |
| 2357 BrowsingDataRemover::EVERYTHING, // All time periods. |
| 2358 base::Time()); |
| 2359 remover->Remove(remove_mask); |
| 2360 // BrowsingDataRemover deletes itself. |
| 2361 } |
2352 | 2362 |
2353 void AutomationProvider::WaitForBrowserWindowCountToBecome( | 2363 void AutomationProvider::WaitForBrowserWindowCountToBecome( |
2354 int target_count, IPC::Message* reply_message) { | 2364 int target_count, IPC::Message* reply_message) { |
2355 if (static_cast<int>(BrowserList::size()) == target_count) { | 2365 if (static_cast<int>(BrowserList::size()) == target_count) { |
2356 AutomationMsg_WaitForBrowserWindowCountToBecome::WriteReplyParams( | 2366 AutomationMsg_WaitForBrowserWindowCountToBecome::WriteReplyParams( |
2357 reply_message, true); | 2367 reply_message, true); |
2358 Send(reply_message); | 2368 Send(reply_message); |
2359 return; | 2369 return; |
2360 } | 2370 } |
2361 | 2371 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 | 2561 |
2552 void AutomationProvider::StartTrackingPopupMenus( | 2562 void AutomationProvider::StartTrackingPopupMenus( |
2553 int browser_handle, bool* success) { | 2563 int browser_handle, bool* success) { |
2554 NOTIMPLEMENTED(); | 2564 NOTIMPLEMENTED(); |
2555 } | 2565 } |
2556 | 2566 |
2557 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 2567 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
2558 NOTIMPLEMENTED(); | 2568 NOTIMPLEMENTED(); |
2559 } | 2569 } |
2560 #endif // !defined(TOOLKIT_VIEWS) | 2570 #endif // !defined(TOOLKIT_VIEWS) |
OLD | NEW |