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