OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 } | 1665 } |
1666 | 1666 |
1667 if (id >= IDC_OPEN_LINK_IN_PROFILE_FIRST && | 1667 if (id >= IDC_OPEN_LINK_IN_PROFILE_FIRST && |
1668 id <= IDC_OPEN_LINK_IN_PROFILE_LAST) { | 1668 id <= IDC_OPEN_LINK_IN_PROFILE_LAST) { |
1669 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1669 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1670 const ProfileInfoCache& profile_info_cache = | 1670 const ProfileInfoCache& profile_info_cache = |
1671 profile_manager->GetProfileInfoCache(); | 1671 profile_manager->GetProfileInfoCache(); |
1672 | 1672 |
1673 base::FilePath profile_path = profile_info_cache.GetPathOfProfileAtIndex( | 1673 base::FilePath profile_path = profile_info_cache.GetPathOfProfileAtIndex( |
1674 id - IDC_OPEN_LINK_IN_PROFILE_FIRST); | 1674 id - IDC_OPEN_LINK_IN_PROFILE_FIRST); |
1675 chrome::HostDesktopType desktop_type = | |
1676 chrome::GetHostDesktopTypeForNativeView( | |
1677 source_web_contents_->GetNativeView()); | |
1678 | 1675 |
1679 Profile* profile = profile_manager->GetProfileByPath(profile_path); | 1676 Profile* profile = profile_manager->GetProfileByPath(profile_path); |
1680 UmaEnumOpenLinkAsUser profile_state; | 1677 UmaEnumOpenLinkAsUser profile_state; |
1681 if (chrome::FindLastActiveWithProfile(profile)) { | 1678 if (chrome::FindLastActiveWithProfile(profile)) { |
1682 profile_state = OPEN_LINK_AS_USER_ACTIVE_PROFILE_ENUM_ID; | 1679 profile_state = OPEN_LINK_AS_USER_ACTIVE_PROFILE_ENUM_ID; |
1683 } else if (multiple_profiles_open_) { | 1680 } else if (multiple_profiles_open_) { |
1684 profile_state = | 1681 profile_state = |
1685 OPEN_LINK_AS_USER_INACTIVE_PROFILE_MULTI_PROFILE_SESSION_ENUM_ID; | 1682 OPEN_LINK_AS_USER_INACTIVE_PROFILE_MULTI_PROFILE_SESSION_ENUM_ID; |
1686 } else { | 1683 } else { |
1687 profile_state = | 1684 profile_state = |
1688 OPEN_LINK_AS_USER_INACTIVE_PROFILE_SINGLE_PROFILE_SESSION_ENUM_ID; | 1685 OPEN_LINK_AS_USER_INACTIVE_PROFILE_SINGLE_PROFILE_SESSION_ENUM_ID; |
1689 } | 1686 } |
1690 UMA_HISTOGRAM_ENUMERATION("RenderViewContextMenu.OpenLinkAsUser", | 1687 UMA_HISTOGRAM_ENUMERATION("RenderViewContextMenu.OpenLinkAsUser", |
1691 profile_state, OPEN_LINK_AS_USER_LAST_ENUM_ID); | 1688 profile_state, OPEN_LINK_AS_USER_LAST_ENUM_ID); |
1692 | 1689 |
1693 profiles::SwitchToProfile( | 1690 profiles::SwitchToProfile( |
1694 profile_path, desktop_type, false, | 1691 profile_path, false, |
1695 base::Bind(OnProfileCreated, params_.link_url, | 1692 base::Bind(OnProfileCreated, params_.link_url, |
1696 CreateReferrer(params_.link_url, params_)), | 1693 CreateReferrer(params_.link_url, params_)), |
1697 ProfileMetrics::SWITCH_PROFILE_CONTEXT_MENU); | 1694 ProfileMetrics::SWITCH_PROFILE_CONTEXT_MENU); |
1698 return; | 1695 return; |
1699 } | 1696 } |
1700 | 1697 |
1701 switch (id) { | 1698 switch (id) { |
1702 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: { | 1699 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: { |
1703 Browser* browser = | 1700 Browser* browser = |
1704 chrome::FindBrowserWithWebContents(source_web_contents_); | 1701 chrome::FindBrowserWithWebContents(source_web_contents_); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 source_web_contents_->GetRenderViewHost()-> | 2195 source_web_contents_->GetRenderViewHost()-> |
2199 ExecuteMediaPlayerActionAtLocation(location, action); | 2196 ExecuteMediaPlayerActionAtLocation(location, action); |
2200 } | 2197 } |
2201 | 2198 |
2202 void RenderViewContextMenu::PluginActionAt( | 2199 void RenderViewContextMenu::PluginActionAt( |
2203 const gfx::Point& location, | 2200 const gfx::Point& location, |
2204 const WebPluginAction& action) { | 2201 const WebPluginAction& action) { |
2205 source_web_contents_->GetRenderViewHost()-> | 2202 source_web_contents_->GetRenderViewHost()-> |
2206 ExecutePluginActionAtLocation(location, action); | 2203 ExecutePluginActionAtLocation(location, action); |
2207 } | 2204 } |
OLD | NEW |