| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_frame/external_tab.h" | 5 #include "chrome_frame/external_tab.h" |
| 6 #include "base/singleton.h" | 6 #include "base/singleton.h" |
| 7 #include "base/tracked.h" | 7 #include "base/tracked.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
| 10 #include "chrome/common/automation_messages.h" | 10 #include "chrome/common/automation_messages.h" |
| 11 #include "chrome_frame/chrome_frame_delegate.h" |
| 11 #include "chrome_frame/utils.h" | 12 #include "chrome_frame/utils.h" |
| 12 | 13 |
| 13 DISABLE_RUNNABLE_METHOD_REFCOUNT(ExternalTabProxy); | 14 DISABLE_RUNNABLE_METHOD_REFCOUNT(ExternalTabProxy); |
| 14 DISABLE_RUNNABLE_METHOD_REFCOUNT(UIDelegate); | 15 DISABLE_RUNNABLE_METHOD_REFCOUNT(UIDelegate); |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 Singleton<ChromeProxyFactory> g_proxy_factory; | 18 Singleton<ChromeProxyFactory> g_proxy_factory; |
| 18 | 19 |
| 19 struct UserDataHolder : public SyncMessageContext { | 20 struct UserDataHolder : public SyncMessageContext { |
| 20 explicit UserDataHolder(void* p) : data(p) {} | 21 explicit UserDataHolder(void* p) : data(p) {} |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void ExternalTabProxy::PeerLost(ChromeProxy* proxy, DisconnectReason reason) { | 115 void ExternalTabProxy::PeerLost(ChromeProxy* proxy, DisconnectReason reason) { |
| 115 ui_.PostTask(FROM_HERE, NewRunnableMethod(this, &ExternalTabProxy::UiPeerLost, | 116 ui_.PostTask(FROM_HERE, NewRunnableMethod(this, &ExternalTabProxy::UiPeerLost, |
| 116 proxy, reason)); | 117 proxy, reason)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void ExternalTabProxy::UiPeerLost(ChromeProxy* proxy, DisconnectReason reason) { | 120 void ExternalTabProxy::UiPeerLost(ChromeProxy* proxy, DisconnectReason reason) { |
| 120 // TODO(stoyan): | 121 // TODO(stoyan): |
| 121 } | 122 } |
| 122 | 123 |
| 123 void ExternalTabProxy::Navigate(const std::string& url, | 124 void ExternalTabProxy::Navigate(const std::string& url, |
| 124 const std::string& referrer, bool is_privileged) { | 125 const std::string& referrer, |
| 126 NavigationConstraints* navigation_constraints) { |
| 125 // in ui thread | 127 // in ui thread |
| 126 // Catch invalid URLs early. Can we allow this navigation to happen? | 128 // Catch invalid URLs early. Can we allow this navigation to happen? |
| 127 GURL parsed_url(url); | 129 GURL parsed_url(url); |
| 128 if (!CanNavigate(parsed_url, security_manager_, is_privileged)) { | 130 if (!CanNavigate(parsed_url, navigation_constraints)) { |
| 129 DLOG(ERROR) << __FUNCTION__ << " Not allowing navigation to: " << url; | 131 DLOG(ERROR) << __FUNCTION__ << " Not allowing navigation to: " << url; |
| 130 return; | 132 return; |
| 131 } | 133 } |
| 132 | 134 |
| 133 GURL parsed_referrer(referrer); | 135 GURL parsed_referrer(referrer); |
| 134 // If we are still establishing channel, simply replace the params | 136 // If we are still establishing channel, simply replace the params |
| 135 if (state_ == INIT_IN_PROGRESS) { | 137 if (state_ == INIT_IN_PROGRESS) { |
| 136 tab_params_.url = parsed_url; | 138 tab_params_.url = parsed_url; |
| 137 tab_params_.referrer = parsed_referrer; | 139 tab_params_.referrer = parsed_referrer; |
| 138 } | 140 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 333 } |
| 332 | 334 |
| 333 void ExternalTabProxy::TabClosed() { | 335 void ExternalTabProxy::TabClosed() { |
| 334 // TODO(stoyan): | 336 // TODO(stoyan): |
| 335 } | 337 } |
| 336 | 338 |
| 337 void ExternalTabProxy::AttachTab( | 339 void ExternalTabProxy::AttachTab( |
| 338 const IPC::AttachExternalTabParams& attach_params) { | 340 const IPC::AttachExternalTabParams& attach_params) { |
| 339 // TODO(stoyan): | 341 // TODO(stoyan): |
| 340 } | 342 } |
| OLD | NEW |