| 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_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 18 #include "base/string_number_conversions.h" |
| 18 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 20 #include "base/values.h" | 21 #include "base/values.h" |
| 21 #include "chrome/app/chrome_command_ids.h" | 22 #include "chrome/app/chrome_command_ids.h" |
| 22 #include "chrome/browser/automation/automation_provider.h" | 23 #include "chrome/browser/automation/automation_provider.h" |
| 23 #include "chrome/browser/automation/automation_provider_json.h" | 24 #include "chrome/browser/automation/automation_provider_json.h" |
| 24 #include "chrome/browser/bookmarks/bookmark_model.h" | 25 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 25 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/dom_operation_notification_details.h" | 27 #include "chrome/browser/dom_operation_notification_details.h" |
| 27 #include "chrome/browser/download/download_item.h" | 28 #include "chrome/browser/download/download_item.h" |
| (...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 } | 2145 } |
| 2145 } | 2146 } |
| 2146 } else if (type.value == NotificationType::BROWSER_WINDOW_READY) { | 2147 } else if (type.value == NotificationType::BROWSER_WINDOW_READY) { |
| 2147 new_window_id_ = ExtensionTabUtil::GetWindowId( | 2148 new_window_id_ = ExtensionTabUtil::GetWindowId( |
| 2148 Source<Browser>(source).ptr()); | 2149 Source<Browser>(source).ptr()); |
| 2149 } else { | 2150 } else { |
| 2150 NOTREACHED(); | 2151 NOTREACHED(); |
| 2151 } | 2152 } |
| 2152 } | 2153 } |
| 2153 | 2154 |
| 2154 AutocompleteEditFocusedObserver::AutocompleteEditFocusedObserver( | |
| 2155 AutomationProvider* automation, | |
| 2156 AutocompleteEditModel* autocomplete_edit, | |
| 2157 IPC::Message* reply_message) | |
| 2158 : automation_(automation->AsWeakPtr()), | |
| 2159 reply_message_(reply_message), | |
| 2160 autocomplete_edit_model_(autocomplete_edit) { | |
| 2161 Source<AutocompleteEditModel> source(autocomplete_edit); | |
| 2162 registrar_.Add(this, NotificationType::OMNIBOX_FOCUSED, source); | |
| 2163 } | |
| 2164 | |
| 2165 AutocompleteEditFocusedObserver::~AutocompleteEditFocusedObserver() {} | |
| 2166 | |
| 2167 void AutocompleteEditFocusedObserver::Observe( | |
| 2168 NotificationType type, | |
| 2169 const NotificationSource& source, | |
| 2170 const NotificationDetails& details) { | |
| 2171 DCHECK(type == NotificationType::OMNIBOX_FOCUSED); | |
| 2172 if (automation_) { | |
| 2173 AutomationMsg_WaitForAutocompleteEditFocus::WriteReplyParams( | |
| 2174 reply_message_.get(), true); | |
| 2175 automation_->Send(reply_message_.release()); | |
| 2176 } | |
| 2177 delete this; | |
| 2178 } | |
| 2179 | |
| 2180 AutofillDisplayedObserver::AutofillDisplayedObserver( | 2155 AutofillDisplayedObserver::AutofillDisplayedObserver( |
| 2181 NotificationType notification, | 2156 NotificationType notification, |
| 2182 RenderViewHost* render_view_host, | 2157 RenderViewHost* render_view_host, |
| 2183 AutomationProvider* automation, | 2158 AutomationProvider* automation, |
| 2184 IPC::Message* reply_message) | 2159 IPC::Message* reply_message) |
| 2185 : notification_(notification), | 2160 : notification_(notification), |
| 2186 render_view_host_(render_view_host), | 2161 render_view_host_(render_view_host), |
| 2187 automation_(automation->AsWeakPtr()), | 2162 automation_(automation->AsWeakPtr()), |
| 2188 reply_message_(reply_message) { | 2163 reply_message_(reply_message) { |
| 2189 Source<RenderViewHost> source(render_view_host_); | 2164 Source<RenderViewHost> source(render_view_host_); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 this, | 2548 this, |
| 2574 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); | 2549 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); |
| 2575 } | 2550 } |
| 2576 | 2551 |
| 2577 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { | 2552 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { |
| 2578 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2553 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2579 if (automation_) | 2554 if (automation_) |
| 2580 automation_->Send(reply_message_.release()); | 2555 automation_->Send(reply_message_.release()); |
| 2581 Release(); | 2556 Release(); |
| 2582 } | 2557 } |
| OLD | NEW |