| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/common/chrome_constants.h" | 36 #include "chrome/common/chrome_constants.h" |
| 37 #include "chrome/common/chrome_notification_types.h" | 37 #include "chrome/common/chrome_notification_types.h" |
| 38 #include "chrome/common/render_messages.h" | 38 #include "chrome/common/render_messages.h" |
| 39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
| 40 #include "content/browser/load_notification_details.h" | 40 #include "content/browser/load_notification_details.h" |
| 41 #include "content/browser/renderer_host/render_process_host.h" | 41 #include "content/browser/renderer_host/render_process_host.h" |
| 42 #include "content/browser/renderer_host/render_view_host.h" | 42 #include "content/browser/renderer_host/render_view_host.h" |
| 43 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 43 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 44 #include "content/browser/tab_contents/navigation_details.h" | 44 #include "content/browser/tab_contents/navigation_details.h" |
| 45 #include "content/browser/tab_contents/provisional_load_details.h" | 45 #include "content/browser/tab_contents/provisional_load_details.h" |
| 46 #include "content/common/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 47 #include "content/common/page_zoom.h" | 47 #include "content/common/page_zoom.h" |
| 48 #include "content/common/view_messages.h" | 48 #include "content/common/view_messages.h" |
| 49 #include "content/public/browser/native_web_keyboard_event.h" | 49 #include "content/public/browser/native_web_keyboard_event.h" |
| 50 #include "content/public/common/bindings_policy.h" | 50 #include "content/public/common/bindings_policy.h" |
| 51 #include "content/public/common/page_transition_types.h" | 51 #include "content/public/common/page_transition_types.h" |
| 52 #include "grit/generated_resources.h" | 52 #include "grit/generated_resources.h" |
| 53 #include "grit/locale_settings.h" | 53 #include "grit/locale_settings.h" |
| 54 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
| 55 #include "ui/base/resource/resource_bundle.h" | 55 #include "ui/base/resource/resource_bundle.h" |
| 56 #include "ui/base/view_prop.h" | 56 #include "ui/base/view_prop.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 NavigationController* controller = &tab_contents_->controller(); | 211 NavigationController* controller = &tab_contents_->controller(); |
| 212 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 212 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 213 content::Source<NavigationController>(controller)); | 213 content::Source<NavigationController>(controller)); |
| 214 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 214 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
| 215 content::Source<NavigationController>(controller)); | 215 content::Source<NavigationController>(controller)); |
| 216 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 216 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 217 content::Source<NavigationController>(controller)); | 217 content::Source<NavigationController>(controller)); |
| 218 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 218 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 219 content::Source<TabContents>(tab_contents_->tab_contents())); | 219 content::Source<TabContents>(tab_contents_->tab_contents())); |
| 220 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 220 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| 221 NotificationService::AllSources()); | 221 content::NotificationService::AllSources()); |
| 222 | 222 |
| 223 TabContentsObserver::Observe(tab_contents_->tab_contents()); | 223 TabContentsObserver::Observe(tab_contents_->tab_contents()); |
| 224 | 224 |
| 225 // Start loading initial URL | 225 // Start loading initial URL |
| 226 if (!initial_url.is_empty()) { | 226 if (!initial_url.is_empty()) { |
| 227 // Navigate out of context since we don't have a 'tab_handle_' yet. | 227 // Navigate out of context since we don't have a 'tab_handle_' yet. |
| 228 MessageLoop::current()->PostTask( | 228 MessageLoop::current()->PostTask( |
| 229 FROM_HERE, | 229 FROM_HERE, |
| 230 external_method_factory_.NewRunnableMethod( | 230 external_method_factory_.NewRunnableMethod( |
| 231 &ExternalTabContainer::Navigate, initial_url, referrer)); | 231 &ExternalTabContainer::Navigate, initial_url, referrer)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 252 } | 252 } |
| 253 | 253 |
| 254 void ExternalTabContainer::Uninitialize() { | 254 void ExternalTabContainer::Uninitialize() { |
| 255 registrar_.RemoveAll(); | 255 registrar_.RemoveAll(); |
| 256 if (tab_contents_.get()) { | 256 if (tab_contents_.get()) { |
| 257 UnregisterRenderViewHost(tab_contents_->render_view_host()); | 257 UnregisterRenderViewHost(tab_contents_->render_view_host()); |
| 258 | 258 |
| 259 if (GetWidget()->GetRootView()) | 259 if (GetWidget()->GetRootView()) |
| 260 GetWidget()->GetRootView()->RemoveAllChildViews(true); | 260 GetWidget()->GetRootView()->RemoveAllChildViews(true); |
| 261 | 261 |
| 262 NotificationService::current()->Notify( | 262 content::NotificationService::current()->Notify( |
| 263 chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, | 263 chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, |
| 264 content::Source<NavigationController>(&tab_contents_->controller()), | 264 content::Source<NavigationController>(&tab_contents_->controller()), |
| 265 content::Details<ExternalTabContainer>(this)); | 265 content::Details<ExternalTabContainer>(this)); |
| 266 | 266 |
| 267 tab_contents_.reset(NULL); | 267 tab_contents_.reset(NULL); |
| 268 } | 268 } |
| 269 | 269 |
| 270 if (focus_manager_) { | 270 if (focus_manager_) { |
| 271 focus_manager_->UnregisterAccelerators(this); | 271 focus_manager_->UnregisterAccelerators(this); |
| 272 focus_manager_ = NULL; | 272 focus_manager_ = NULL; |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 if (params.disposition == CURRENT_TAB) { | 1214 if (params.disposition == CURRENT_TAB) { |
| 1215 DCHECK(route_all_top_level_navigations_); | 1215 DCHECK(route_all_top_level_navigations_); |
| 1216 forward_params.disposition = NEW_FOREGROUND_TAB; | 1216 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1217 } | 1217 } |
| 1218 TabContents* new_contents = | 1218 TabContents* new_contents = |
| 1219 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1219 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
| 1220 // support only one navigation for a dummy tab before it is killed. | 1220 // support only one navigation for a dummy tab before it is killed. |
| 1221 ::DestroyWindow(GetNativeView()); | 1221 ::DestroyWindow(GetNativeView()); |
| 1222 return new_contents; | 1222 return new_contents; |
| 1223 } | 1223 } |
| OLD | NEW |