| 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 "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.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" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "win8/util/win8_util.h" | 14 #include "win8/util/win8_util.h" |
| 15 | 15 |
| 16 using content::WebContents; | 16 using content::WebContents; |
| 17 | 17 |
| 18 RenderViewContextMenuWin::RenderViewContextMenuWin( | 18 RenderViewContextMenuWin::RenderViewContextMenuWin( |
| 19 WebContents* web_contents, | 19 content::RenderFrameHost* render_frame_host, |
| 20 const content::ContextMenuParams& params) | 20 const content::ContextMenuParams& params) |
| 21 : RenderViewContextMenuViews(web_contents, params) { | 21 : RenderViewContextMenuViews(render_frame_host, params) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 RenderViewContextMenuWin::~RenderViewContextMenuWin() { | 24 RenderViewContextMenuWin::~RenderViewContextMenuWin() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 RenderViewContextMenuViews* RenderViewContextMenuViews::Create( | 28 RenderViewContextMenuViews* RenderViewContextMenuViews::Create( |
| 29 content::WebContents* web_contents, | 29 content::RenderFrameHost* render_frame_host, |
| 30 const content::ContextMenuParams& params) { | 30 const content::ContextMenuParams& params) { |
| 31 return new RenderViewContextMenuWin(web_contents, params); | 31 return new RenderViewContextMenuWin(render_frame_host, params); |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool RenderViewContextMenuWin::IsCommandIdVisible(int command_id) const { | 34 bool RenderViewContextMenuWin::IsCommandIdVisible(int command_id) const { |
| 35 // In windows 8 metro mode no new window option on normal browser windows. | 35 // In windows 8 metro mode no new window option on normal browser windows. |
| 36 if (win8::IsSingleWindowMetroMode() && !profile_->IsOffTheRecord() && | 36 if (win8::IsSingleWindowMetroMode() && !profile_->IsOffTheRecord() && |
| 37 command_id == IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW) { | 37 command_id == IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW) { |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 return RenderViewContextMenu::IsCommandIdVisible(command_id); | 40 return RenderViewContextMenu::IsCommandIdVisible(command_id); |
| 41 } | 41 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 false); | 69 false); |
| 70 WebContents* source_web_contents = | 70 WebContents* source_web_contents = |
| 71 browser->tab_strip_model()->GetActiveWebContents(); | 71 browser->tab_strip_model()->GetActiveWebContents(); |
| 72 WebContents* new_contents = source_web_contents->OpenURL(url_params); | 72 WebContents* new_contents = source_web_contents->OpenURL(url_params); |
| 73 DCHECK(new_contents); | 73 DCHECK(new_contents); |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); | 77 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); |
| 78 } | 78 } |
| OLD | NEW |