OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "chrome/browser/content_settings/host_content_settings_map.h" | 41 #include "chrome/browser/content_settings/host_content_settings_map.h" |
42 #include "chrome/browser/net/url_request_mock_util.h" | 42 #include "chrome/browser/net/url_request_mock_util.h" |
43 #include "chrome/browser/prefs/pref_service.h" | 43 #include "chrome/browser/prefs/pref_service.h" |
44 #include "chrome/browser/printing/print_job.h" | 44 #include "chrome/browser/printing/print_job.h" |
45 #include "chrome/browser/profiles/profile_manager.h" | 45 #include "chrome/browser/profiles/profile_manager.h" |
46 #include "chrome/browser/ssl/ssl_blocking_page.h" | 46 #include "chrome/browser/ssl/ssl_blocking_page.h" |
47 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 47 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
48 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 48 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
49 #include "chrome/browser/ui/browser_commands.h" | 49 #include "chrome/browser/ui/browser_commands.h" |
50 #include "chrome/browser/ui/browser_finder.h" | 50 #include "chrome/browser/ui/browser_finder.h" |
| 51 #include "chrome/browser/ui/browser_tabstrip.h" |
51 #include "chrome/browser/ui/browser_window.h" | 52 #include "chrome/browser/ui/browser_window.h" |
52 #include "chrome/browser/ui/find_bar/find_bar.h" | 53 #include "chrome/browser/ui/find_bar/find_bar.h" |
53 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 54 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
54 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 55 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
55 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 56 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
56 #include "chrome/browser/ui/login/login_prompt.h" | 57 #include "chrome/browser/ui/login/login_prompt.h" |
57 #include "chrome/browser/ui/omnibox/location_bar.h" | 58 #include "chrome/browser/ui/omnibox/location_bar.h" |
58 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 59 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
59 #include "chrome/common/automation_constants.h" | 60 #include "chrome/common/automation_constants.h" |
60 #include "chrome/common/automation_messages.h" | 61 #include "chrome/common/automation_messages.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 void AutomationProvider::DisableInitialLoadObservers() { | 288 void AutomationProvider::DisableInitialLoadObservers() { |
288 use_initial_load_observers_ = false; | 289 use_initial_load_observers_ = false; |
289 OnInitialTabLoadsComplete(); | 290 OnInitialTabLoadsComplete(); |
290 OnNetworkLibraryInit(); | 291 OnNetworkLibraryInit(); |
291 OnOOBEWebuiReady(); | 292 OnOOBEWebuiReady(); |
292 } | 293 } |
293 | 294 |
294 int AutomationProvider::GetIndexForNavigationController( | 295 int AutomationProvider::GetIndexForNavigationController( |
295 const NavigationController* controller, const Browser* parent) const { | 296 const NavigationController* controller, const Browser* parent) const { |
296 DCHECK(parent); | 297 DCHECK(parent); |
297 return parent->GetIndexOfController(controller); | 298 return chrome::GetIndexOfTab(parent, controller->GetWebContents()); |
298 } | 299 } |
299 | 300 |
300 // TODO(phajdan.jr): move to TestingAutomationProvider. | 301 // TODO(phajdan.jr): move to TestingAutomationProvider. |
301 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( | 302 DictionaryValue* AutomationProvider::GetDictionaryFromDownloadItem( |
302 const DownloadItem* download) { | 303 const DownloadItem* download) { |
303 std::map<DownloadItem::DownloadState, std::string> state_to_string; | 304 std::map<DownloadItem::DownloadState, std::string> state_to_string; |
304 state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS"); | 305 state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS"); |
305 state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED"); | 306 state_to_string[DownloadItem::CANCELLED] = std::string("CANCELLED"); |
306 state_to_string[DownloadItem::REMOVING] = std::string("REMOVING"); | 307 state_to_string[DownloadItem::REMOVING] = std::string("REMOVING"); |
307 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); | 308 state_to_string[DownloadItem::INTERRUPTED] = std::string("INTERRUPTED"); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 750 |
750 return NULL; | 751 return NULL; |
751 } | 752 } |
752 | 753 |
753 void AutomationProvider::SaveAsAsync(int tab_handle) { | 754 void AutomationProvider::SaveAsAsync(int tab_handle) { |
754 NavigationController* tab = NULL; | 755 NavigationController* tab = NULL; |
755 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); | 756 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); |
756 if (web_contents) | 757 if (web_contents) |
757 web_contents->OnSavePage(); | 758 web_contents->OnSavePage(); |
758 } | 759 } |
OLD | NEW |