| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "content/browser/tab_contents/provisional_load_details.h" | 44 #include "content/browser/tab_contents/provisional_load_details.h" |
| 45 #include "content/public/browser/intents_host.h" | 45 #include "content/public/browser/intents_host.h" |
| 46 #include "content/public/browser/native_web_keyboard_event.h" | 46 #include "content/public/browser/native_web_keyboard_event.h" |
| 47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 48 #include "content/public/common/bindings_policy.h" | 48 #include "content/public/common/bindings_policy.h" |
| 49 #include "content/public/common/frame_navigate_params.h" | 49 #include "content/public/common/frame_navigate_params.h" |
| 50 #include "content/public/common/page_transition_types.h" | 50 #include "content/public/common/page_transition_types.h" |
| 51 #include "content/public/common/page_zoom.h" | 51 #include "content/public/common/page_zoom.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 "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
| 55 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" |
| 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
| 54 #include "ui/base/l10n/l10n_util.h" | 58 #include "ui/base/l10n/l10n_util.h" |
| 55 #include "ui/base/models/menu_model.h" | 59 #include "ui/base/models/menu_model.h" |
| 56 #include "ui/base/resource/resource_bundle.h" | 60 #include "ui/base/resource/resource_bundle.h" |
| 57 #include "ui/base/view_prop.h" | 61 #include "ui/base/view_prop.h" |
| 58 #include "ui/views/layout/grid_layout.h" | 62 #include "ui/views/layout/grid_layout.h" |
| 59 | 63 |
| 60 using content::BrowserThread; | 64 using content::BrowserThread; |
| 61 using ui::ViewProp; | 65 using ui::ViewProp; |
| 66 using WebKit::WebCString; |
| 67 using WebKit::WebString; |
| 68 using WebKit::WebReferrerPolicy; |
| 69 using WebKit::WebSecurityPolicy; |
| 62 | 70 |
| 63 static const char kWindowObjectKey[] = "ChromeWindowObject"; | 71 static const char kWindowObjectKey[] = "ChromeWindowObject"; |
| 64 | 72 |
| 65 namespace { | 73 namespace { |
| 66 | 74 |
| 67 // Convert ui::MenuModel into a serializable form for Chrome Frame | 75 // Convert ui::MenuModel into a serializable form for Chrome Frame |
| 68 ContextMenuModel* ConvertMenuModel(const ui::MenuModel* ui_model) { | 76 ContextMenuModel* ConvertMenuModel(const ui::MenuModel* ui_model) { |
| 69 ContextMenuModel* new_model = new ContextMenuModel; | 77 ContextMenuModel* new_model = new ContextMenuModel; |
| 70 | 78 |
| 71 const int index_base = ui_model->GetFirstItemIndex(NULL); | 79 const int index_base = ui_model->GetFirstItemIndex(NULL); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 348 |
| 341 switch (params.disposition) { | 349 switch (params.disposition) { |
| 342 case CURRENT_TAB: | 350 case CURRENT_TAB: |
| 343 case SINGLETON_TAB: | 351 case SINGLETON_TAB: |
| 344 case NEW_FOREGROUND_TAB: | 352 case NEW_FOREGROUND_TAB: |
| 345 case NEW_BACKGROUND_TAB: | 353 case NEW_BACKGROUND_TAB: |
| 346 case NEW_POPUP: | 354 case NEW_POPUP: |
| 347 case NEW_WINDOW: | 355 case NEW_WINDOW: |
| 348 case SAVE_TO_DISK: | 356 case SAVE_TO_DISK: |
| 349 if (automation_) { | 357 if (automation_) { |
| 358 GURL referrer = GURL(WebSecurityPolicy::generateReferrerHeader( |
| 359 params.referrer.policy, |
| 360 params.url, |
| 361 WebString::fromUTF8(params.referrer.url.spec())).utf8()); |
| 350 automation_->Send(new AutomationMsg_OpenURL(tab_handle_, | 362 automation_->Send(new AutomationMsg_OpenURL(tab_handle_, |
| 351 params.url, | 363 params.url, |
| 352 params.referrer, | 364 referrer, |
| 353 params.disposition)); | 365 params.disposition)); |
| 354 // TODO(ananta) | 366 // TODO(ananta) |
| 355 // We should populate other fields in the | 367 // We should populate other fields in the |
| 356 // ViewHostMsg_FrameNavigate_Params structure. Another option could be | 368 // ViewHostMsg_FrameNavigate_Params structure. Another option could be |
| 357 // to refactor the UpdateHistoryForNavigation function in TabContents. | 369 // to refactor the UpdateHistoryForNavigation function in TabContents. |
| 358 content::FrameNavigateParams nav_params; | 370 content::FrameNavigateParams nav_params; |
| 359 nav_params.referrer = content::Referrer( | 371 nav_params.referrer = content::Referrer(referrer, |
| 360 params.referrer, | 372 params.referrer.policy); |
| 361 WebKit::WebReferrerPolicyDefault); | |
| 362 nav_params.url = params.url; | 373 nav_params.url = params.url; |
| 363 nav_params.page_id = -1; | 374 nav_params.page_id = -1; |
| 364 nav_params.transition = content::PAGE_TRANSITION_LINK; | 375 nav_params.transition = content::PAGE_TRANSITION_LINK; |
| 365 | 376 |
| 366 content::LoadCommittedDetails details; | 377 content::LoadCommittedDetails details; |
| 367 details.did_replace_entry = false; | 378 details.did_replace_entry = false; |
| 368 | 379 |
| 369 scoped_refptr<history::HistoryAddPageArgs> add_page_args( | 380 scoped_refptr<history::HistoryAddPageArgs> add_page_args( |
| 370 tab_contents_->history_tab_helper()-> | 381 tab_contents_->history_tab_helper()-> |
| 371 CreateHistoryAddPageArgs(params.url, details, nav_params)); | 382 CreateHistoryAddPageArgs(params.url, details, nav_params)); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 if (params.disposition == CURRENT_TAB) { | 1171 if (params.disposition == CURRENT_TAB) { |
| 1161 DCHECK(route_all_top_level_navigations_); | 1172 DCHECK(route_all_top_level_navigations_); |
| 1162 forward_params.disposition = NEW_FOREGROUND_TAB; | 1173 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1163 } | 1174 } |
| 1164 TabContents* new_contents = | 1175 TabContents* new_contents = |
| 1165 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1176 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
| 1166 // support only one navigation for a dummy tab before it is killed. | 1177 // support only one navigation for a dummy tab before it is killed. |
| 1167 ::DestroyWindow(GetNativeView()); | 1178 ::DestroyWindow(GetNativeView()); |
| 1168 return new_contents; | 1179 return new_contents; |
| 1169 } | 1180 } |
| OLD | NEW |