OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/tab_contents/render_view_context_menu_win.h" | 5 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h" |
6 | 6 |
7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/tab_contents/retargeting_details.h" | 10 #include "chrome/browser/tab_contents/retargeting_details.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if (base::win::IsMetroProcess() && | 49 if (base::win::IsMetroProcess() && |
50 command_id == IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW) { | 50 command_id == IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW) { |
51 // The open link in new window command should only be enabled for | 51 // The open link in new window command should only be enabled for |
52 // incognito windows in metro mode. | 52 // incognito windows in metro mode. |
53 DCHECK(profile_->IsOffTheRecord()); | 53 DCHECK(profile_->IsOffTheRecord()); |
54 // We directly go to the Browser object to open the url in effect | 54 // We directly go to the Browser object to open the url in effect |
55 // bypassing the delegate. Currently the Browser is the only class which | 55 // bypassing the delegate. Currently the Browser is the only class which |
56 // implements the delegate for the context menu. This would break if there | 56 // implements the delegate for the context menu. This would break if there |
57 // are other delegates for the context menu. This is ok for now as this | 57 // are other delegates for the context menu. This is ok for now as this |
58 // code only executes for Windows 8 metro mode. | 58 // code only executes for Windows 8 metro mode. |
59 Browser* browser = browser::FindTabbedBrowser( | 59 // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when |
60 profile_->GetOriginalProfile(), false); | 60 // we make that the default for metro. |
| 61 Browser* browser = |
| 62 browser::FindTabbedBrowser(profile_->GetOriginalProfile(), |
| 63 false, |
| 64 chrome::HOST_DESKTOP_TYPE_NATIVE); |
61 if (browser) { | 65 if (browser) { |
62 content::OpenURLParams url_params( | 66 content::OpenURLParams url_params( |
63 params_.link_url, | 67 params_.link_url, |
64 content::Referrer(params_.frame_url.is_empty() ? | 68 content::Referrer(params_.frame_url.is_empty() ? |
65 params_.page_url : params_.frame_url, | 69 params_.page_url : params_.frame_url, |
66 params_.referrer_policy), | 70 params_.referrer_policy), |
67 NEW_FOREGROUND_TAB, | 71 NEW_FOREGROUND_TAB, |
68 content::PAGE_TRANSITION_LINK, | 72 content::PAGE_TRANSITION_LINK, |
69 false); | 73 false); |
70 WebContents* source_web_contents = chrome::GetActiveWebContents(browser); | 74 WebContents* source_web_contents = chrome::GetActiveWebContents(browser); |
71 WebContents* new_contents = source_web_contents->OpenURL(url_params); | 75 WebContents* new_contents = source_web_contents->OpenURL(url_params); |
72 DCHECK(new_contents); | 76 DCHECK(new_contents); |
73 return; | 77 return; |
74 } | 78 } |
75 } | 79 } |
76 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); | 80 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); |
77 } | 81 } |
78 | 82 |
79 void RenderViewContextMenuWin::SetExternal() { | 83 void RenderViewContextMenuWin::SetExternal() { |
80 external_ = true; | 84 external_ = true; |
81 } | 85 } |
OLD | NEW |