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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
13 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
14 #include "base/json/string_escape.h" | 15 #include "base/json/string_escape.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/process_util.h" | 18 #include "base/process_util.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
99 #include "chrome/browser/external_tab_container_win.h" | 100 #include "chrome/browser/external_tab_container_win.h" |
100 #endif // defined(OS_WIN) | 101 #endif // defined(OS_WIN) |
101 | 102 |
102 using WebKit::WebFindOptions; | 103 using WebKit::WebFindOptions; |
103 using base::Time; | 104 using base::Time; |
104 | 105 |
105 AutomationProvider::AutomationProvider(Profile* profile) | 106 AutomationProvider::AutomationProvider(Profile* profile) |
106 : profile_(profile), | 107 : profile_(profile), |
107 reply_message_(NULL), | 108 reply_message_(NULL), |
108 reinitialize_on_channel_error_(false), | 109 reinitialize_on_channel_error_( |
| 110 CommandLine::ForCurrentProcess()->HasSwitch( |
| 111 switches::kAutomationReinitializeOnChannelError)), |
109 is_connected_(false), | 112 is_connected_(false), |
110 initial_tab_loads_complete_(false), | 113 initial_tab_loads_complete_(false), |
111 network_library_initialized_(true) { | 114 network_library_initialized_(true) { |
112 TRACE_EVENT_BEGIN_ETW("AutomationProvider::AutomationProvider", 0, ""); | 115 TRACE_EVENT_BEGIN_ETW("AutomationProvider::AutomationProvider", 0, ""); |
113 | 116 |
114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
115 | 118 |
116 browser_tracker_.reset(new AutomationBrowserTracker(this)); | 119 browser_tracker_.reset(new AutomationBrowserTracker(this)); |
117 extension_tracker_.reset(new AutomationExtensionTracker(this)); | 120 extension_tracker_.reset(new AutomationExtensionTracker(this)); |
118 tab_tracker_.reset(new AutomationTabTracker(this)); | 121 tab_tracker_.reset(new AutomationTabTracker(this)); |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 } | 944 } |
942 } | 945 } |
943 } | 946 } |
944 | 947 |
945 void AutomationProvider::SaveAsAsync(int tab_handle) { | 948 void AutomationProvider::SaveAsAsync(int tab_handle) { |
946 NavigationController* tab = NULL; | 949 NavigationController* tab = NULL; |
947 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 950 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
948 if (tab_contents) | 951 if (tab_contents) |
949 tab_contents->OnSavePage(); | 952 tab_contents->OnSavePage(); |
950 } | 953 } |
OLD | NEW |