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/external_tab_container_win.h" | 5 #include "chrome/browser/external_tab_container_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 60 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" |
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
63 #include "ui/base/l10n/l10n_util.h" | 63 #include "ui/base/l10n/l10n_util.h" |
64 #include "ui/base/models/menu_model.h" | 64 #include "ui/base/models/menu_model.h" |
65 #include "ui/base/resource/resource_bundle.h" | 65 #include "ui/base/resource/resource_bundle.h" |
66 #include "ui/base/view_prop.h" | 66 #include "ui/base/view_prop.h" |
67 #include "ui/views/layout/grid_layout.h" | 67 #include "ui/views/layout/grid_layout.h" |
68 | 68 |
69 using content::BrowserThread; | 69 using content::BrowserThread; |
| 70 using content::NavigationController; |
70 using content::NavigationEntry; | 71 using content::NavigationEntry; |
71 using content::OpenURLParams; | 72 using content::OpenURLParams; |
72 using content::SSLStatus; | 73 using content::SSLStatus; |
73 using content::WebContents; | 74 using content::WebContents; |
74 using ui::ViewProp; | 75 using ui::ViewProp; |
75 using WebKit::WebCString; | 76 using WebKit::WebCString; |
76 using WebKit::WebString; | 77 using WebKit::WebString; |
77 using WebKit::WebReferrerPolicy; | 78 using WebKit::WebReferrerPolicy; |
78 using WebKit::WebSecurityPolicy; | 79 using WebKit::WebSecurityPolicy; |
79 | 80 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 195 |
195 tab_contents_->tab_contents()-> | 196 tab_contents_->tab_contents()-> |
196 GetMutableRendererPrefs()->browser_handles_top_level_requests = | 197 GetMutableRendererPrefs()->browser_handles_top_level_requests = |
197 handle_top_level_requests; | 198 handle_top_level_requests; |
198 | 199 |
199 if (!existing_contents) { | 200 if (!existing_contents) { |
200 tab_contents_->tab_contents()->GetRenderViewHost()->AllowBindings( | 201 tab_contents_->tab_contents()->GetRenderViewHost()->AllowBindings( |
201 content::BINDINGS_POLICY_EXTERNAL_HOST); | 202 content::BINDINGS_POLICY_EXTERNAL_HOST); |
202 } | 203 } |
203 | 204 |
204 content::NavigationController* controller = | 205 NavigationController* controller = |
205 &tab_contents_->web_contents()->GetController(); | 206 &tab_contents_->web_contents()->GetController(); |
206 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 207 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
207 content::Source<content::NavigationController>(controller)); | 208 content::Source<NavigationController>(controller)); |
208 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 209 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
209 content::Source<content::NavigationController>(controller)); | 210 content::Source<NavigationController>(controller)); |
210 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 211 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
211 content::Source<content::NavigationController>(controller)); | 212 content::Source<NavigationController>(controller)); |
212 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 213 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
213 content::Source<WebContents>(tab_contents_->web_contents())); | 214 content::Source<WebContents>(tab_contents_->web_contents())); |
214 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 215 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
215 content::NotificationService::AllSources()); | 216 content::NotificationService::AllSources()); |
216 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, | 217 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, |
217 content::NotificationService::AllSources()); | 218 content::NotificationService::AllSources()); |
218 | 219 |
219 content::WebContentsObserver::Observe(tab_contents_->tab_contents()); | 220 content::WebContentsObserver::Observe(tab_contents_->tab_contents()); |
220 | 221 |
221 // Start loading initial URL | 222 // Start loading initial URL |
(...skipping 29 matching lines...) Expand all Loading... |
251 registrar_.RemoveAll(); | 252 registrar_.RemoveAll(); |
252 if (tab_contents_.get()) { | 253 if (tab_contents_.get()) { |
253 UnregisterRenderViewHost( | 254 UnregisterRenderViewHost( |
254 tab_contents_->web_contents()->GetRenderViewHost()); | 255 tab_contents_->web_contents()->GetRenderViewHost()); |
255 | 256 |
256 if (GetWidget()->GetRootView()) | 257 if (GetWidget()->GetRootView()) |
257 GetWidget()->GetRootView()->RemoveAllChildViews(true); | 258 GetWidget()->GetRootView()->RemoveAllChildViews(true); |
258 | 259 |
259 content::NotificationService::current()->Notify( | 260 content::NotificationService::current()->Notify( |
260 chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, | 261 chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, |
261 content::Source<content::NavigationController>( | 262 content::Source<NavigationController>( |
262 &tab_contents_->web_contents()->GetController()), | 263 &tab_contents_->web_contents()->GetController()), |
263 content::Details<ExternalTabContainer>(this)); | 264 content::Details<ExternalTabContainer>(this)); |
264 | 265 |
265 tab_contents_.reset(NULL); | 266 tab_contents_.reset(NULL); |
266 } | 267 } |
267 | 268 |
268 if (focus_manager_) { | 269 if (focus_manager_) { |
269 focus_manager_->UnregisterAccelerators(this); | 270 focus_manager_->UnregisterAccelerators(this); |
270 focus_manager_ = NULL; | 271 focus_manager_ = NULL; |
271 } | 272 } |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 if (params.disposition == CURRENT_TAB) { | 1201 if (params.disposition == CURRENT_TAB) { |
1201 DCHECK(route_all_top_level_navigations_); | 1202 DCHECK(route_all_top_level_navigations_); |
1202 forward_params.disposition = NEW_FOREGROUND_TAB; | 1203 forward_params.disposition = NEW_FOREGROUND_TAB; |
1203 } | 1204 } |
1204 WebContents* new_contents = | 1205 WebContents* new_contents = |
1205 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1206 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
1206 // support only one navigation for a dummy tab before it is killed. | 1207 // support only one navigation for a dummy tab before it is killed. |
1207 ::DestroyWindow(GetNativeView()); | 1208 ::DestroyWindow(GetNativeView()); |
1208 return new_contents; | 1209 return new_contents; |
1209 } | 1210 } |
OLD | NEW |