| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 NavigationController* tab = tab_tracker_->GetResource(tab_handle); | 2343 NavigationController* tab = tab_tracker_->GetResource(tab_handle); |
| 2342 DCHECK(tab != NULL); | 2344 DCHECK(tab != NULL); |
| 2343 if (tab && tab->tab_contents()) { | 2345 if (tab && tab->tab_contents()) { |
| 2344 DCHECK(tab->tab_contents()->profile() != NULL); | 2346 DCHECK(tab->tab_contents()->profile() != NULL); |
| 2345 tab->tab_contents()->profile()->GetPrefs()->SetInteger( | 2347 tab->tab_contents()->profile()->GetPrefs()->SetInteger( |
| 2346 prefs::kWebKitDefaultFontSize, font_size); | 2348 prefs::kWebKitDefaultFontSize, font_size); |
| 2347 } | 2349 } |
| 2348 } | 2350 } |
| 2349 } | 2351 } |
| 2350 | 2352 |
| 2353 void AutomationProvider::RemoveBrowsingData(int remove_mask) { |
| 2354 BrowsingDataRemover* remover; |
| 2355 remover = new BrowsingDataRemover(profile(), |
| 2356 BrowsingDataRemover::EVERYTHING, // All time periods. |
| 2357 base::Time()); |
| 2358 remover->Remove(remove_mask); |
| 2359 // BrowsingDataRemover deletes itself. |
| 2360 } |
| 2351 | 2361 |
| 2352 void AutomationProvider::WaitForBrowserWindowCountToBecome( | 2362 void AutomationProvider::WaitForBrowserWindowCountToBecome( |
| 2353 int target_count, IPC::Message* reply_message) { | 2363 int target_count, IPC::Message* reply_message) { |
| 2354 if (static_cast<int>(BrowserList::size()) == target_count) { | 2364 if (static_cast<int>(BrowserList::size()) == target_count) { |
| 2355 AutomationMsg_WaitForBrowserWindowCountToBecome::WriteReplyParams( | 2365 AutomationMsg_WaitForBrowserWindowCountToBecome::WriteReplyParams( |
| 2356 reply_message, true); | 2366 reply_message, true); |
| 2357 Send(reply_message); | 2367 Send(reply_message); |
| 2358 return; | 2368 return; |
| 2359 } | 2369 } |
| 2360 | 2370 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2550 | 2560 |
| 2551 void AutomationProvider::StartTrackingPopupMenus( | 2561 void AutomationProvider::StartTrackingPopupMenus( |
| 2552 int browser_handle, bool* success) { | 2562 int browser_handle, bool* success) { |
| 2553 NOTIMPLEMENTED(); | 2563 NOTIMPLEMENTED(); |
| 2554 } | 2564 } |
| 2555 | 2565 |
| 2556 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 2566 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
| 2557 NOTIMPLEMENTED(); | 2567 NOTIMPLEMENTED(); |
| 2558 } | 2568 } |
| 2559 #endif // !defined(TOOLKIT_VIEWS) | 2569 #endif // !defined(TOOLKIT_VIEWS) |
| OLD | NEW |