| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "chrome/common/chrome_paths.h" | 75 #include "chrome/common/chrome_paths.h" |
| 76 #include "chrome/common/chrome_switches.h" | 76 #include "chrome/common/chrome_switches.h" |
| 77 #include "chrome/common/chrome_version_info.h" | 77 #include "chrome/common/chrome_version_info.h" |
| 78 #include "chrome/common/extensions/extension.h" | 78 #include "chrome/common/extensions/extension.h" |
| 79 #include "chrome/common/pref_names.h" | 79 #include "chrome/common/pref_names.h" |
| 80 #include "chrome/common/render_messages.h" | 80 #include "chrome/common/render_messages.h" |
| 81 #include "chrome/common/url_constants.h" | 81 #include "chrome/common/url_constants.h" |
| 82 #include "content/browser/download/save_package.h" | 82 #include "content/browser/download/save_package.h" |
| 83 #include "content/browser/renderer_host/render_view_host.h" | 83 #include "content/browser/renderer_host/render_view_host.h" |
| 84 #include "content/browser/ssl/ssl_manager.h" | 84 #include "content/browser/ssl/ssl_manager.h" |
| 85 #include "content/browser/tab_contents/tab_contents.h" | |
| 86 #include "content/browser/tab_contents/tab_contents_view.h" | 85 #include "content/browser/tab_contents/tab_contents_view.h" |
| 87 #include "content/public/browser/browser_thread.h" | 86 #include "content/public/browser/browser_thread.h" |
| 88 #include "content/public/browser/download_item.h" | 87 #include "content/public/browser/download_item.h" |
| 88 #include "content/public/browser/web_contents.h" |
| 89 #include "net/proxy/proxy_config_service_fixed.h" | 89 #include "net/proxy/proxy_config_service_fixed.h" |
| 90 #include "net/proxy/proxy_service.h" | 90 #include "net/proxy/proxy_service.h" |
| 91 #include "net/url_request/url_request_context.h" | 91 #include "net/url_request/url_request_context.h" |
| 92 #include "net/url_request/url_request_context_getter.h" | 92 #include "net/url_request/url_request_context_getter.h" |
| 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
| 94 | 94 |
| 95 #if defined(OS_WIN) && !defined(USE_AURA) | 95 #if defined(OS_WIN) && !defined(USE_AURA) |
| 96 #include "chrome/browser/external_tab_container_win.h" | 96 #include "chrome/browser/external_tab_container_win.h" |
| 97 #endif // defined(OS_WIN) | 97 #endif // defined(OS_WIN) |
| 98 | 98 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 if (browser && | 627 if (browser && |
| 628 browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { | 628 browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { |
| 629 int selected_encoding_id = | 629 int selected_encoding_id = |
| 630 CharacterEncoding::GetCommandIdByCanonicalEncodingName(encoding_name); | 630 CharacterEncoding::GetCommandIdByCanonicalEncodingName(encoding_name); |
| 631 if (selected_encoding_id) { | 631 if (selected_encoding_id) { |
| 632 browser->OverrideEncoding(selected_encoding_id); | 632 browser->OverrideEncoding(selected_encoding_id); |
| 633 *success = true; | 633 *success = true; |
| 634 } | 634 } |
| 635 } else { | 635 } else { |
| 636 // There is no UI, Chrome probably runs as Chrome-Frame mode. | 636 // There is no UI, Chrome probably runs as Chrome-Frame mode. |
| 637 // Try to get TabContents and call its override_encoding method. | 637 // Try to get WebContents and call its override_encoding method. |
| 638 WebContents* contents = nav->GetWebContents(); | 638 WebContents* contents = nav->GetWebContents(); |
| 639 if (!contents) | 639 if (!contents) |
| 640 return; | 640 return; |
| 641 const std::string selected_encoding = | 641 const std::string selected_encoding = |
| 642 CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding_name); | 642 CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding_name); |
| 643 if (selected_encoding.empty()) | 643 if (selected_encoding.empty()) |
| 644 return; | 644 return; |
| 645 contents->SetOverrideEncoding(selected_encoding); | 645 contents->SetOverrideEncoding(selected_encoding); |
| 646 } | 646 } |
| 647 } | 647 } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 } | 1002 } |
| 1003 } | 1003 } |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 void AutomationProvider::SaveAsAsync(int tab_handle) { | 1006 void AutomationProvider::SaveAsAsync(int tab_handle) { |
| 1007 NavigationController* tab = NULL; | 1007 NavigationController* tab = NULL; |
| 1008 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); | 1008 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); |
| 1009 if (web_contents) | 1009 if (web_contents) |
| 1010 web_contents->OnSavePage(); | 1010 web_contents->OnSavePage(); |
| 1011 } | 1011 } |
| OLD | NEW |