| 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/tab_contents/retargeting_details.h" | 9 #include "chrome/browser/tab_contents/retargeting_details.h" |
| 10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when | 59 // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when |
| 60 // we make that the default for metro. | 60 // we make that the default for metro. |
| 61 Browser* browser = | 61 Browser* browser = |
| 62 browser::FindTabbedBrowser(profile_->GetOriginalProfile(), | 62 chrome::FindTabbedBrowser(profile_->GetOriginalProfile(), |
| 63 false, | 63 false, |
| 64 chrome::HOST_DESKTOP_TYPE_NATIVE); | 64 chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 65 if (browser) { | 65 if (browser) { |
| 66 content::OpenURLParams url_params( | 66 content::OpenURLParams url_params( |
| 67 params_.link_url, | 67 params_.link_url, |
| 68 content::Referrer(params_.frame_url.is_empty() ? | 68 content::Referrer(params_.frame_url.is_empty() ? |
| 69 params_.page_url : params_.frame_url, | 69 params_.page_url : params_.frame_url, |
| 70 params_.referrer_policy), | 70 params_.referrer_policy), |
| 71 NEW_FOREGROUND_TAB, | 71 NEW_FOREGROUND_TAB, |
| 72 content::PAGE_TRANSITION_LINK, | 72 content::PAGE_TRANSITION_LINK, |
| 73 false); | 73 false); |
| 74 WebContents* source_web_contents = chrome::GetActiveWebContents(browser); | 74 WebContents* source_web_contents = chrome::GetActiveWebContents(browser); |
| 75 WebContents* new_contents = source_web_contents->OpenURL(url_params); | 75 WebContents* new_contents = source_web_contents->OpenURL(url_params); |
| 76 DCHECK(new_contents); | 76 DCHECK(new_contents); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); | 80 RenderViewContextMenu::ExecuteCommand(command_id, event_flags); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void RenderViewContextMenuWin::SetExternal() { | 83 void RenderViewContextMenuWin::SetExternal() { |
| 84 external_ = true; | 84 external_ = true; |
| 85 } | 85 } |
| OLD | NEW |