Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 11434074: browser: Move FindBrowserWithWebContents() into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" 9 #include "chrome/browser/tab_contents/render_view_context_menu.h"
10 10
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: 1021 case IDC_CONTENT_CONTEXT_INSPECTELEMENT:
1022 case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE: 1022 case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE:
1023 case IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP: 1023 case IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP:
1024 case IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP: 1024 case IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP:
1025 return IsDevCommandEnabled(id); 1025 return IsDevCommandEnabled(id);
1026 1026
1027 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: 1027 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
1028 if (source_web_contents_->GetController().GetActiveEntry() == NULL) 1028 if (source_web_contents_->GetController().GetActiveEntry() == NULL)
1029 return false; 1029 return false;
1030 // Disabled if no browser is associated (e.g. desktop notifications). 1030 // Disabled if no browser is associated (e.g. desktop notifications).
1031 if (browser::FindBrowserWithWebContents(source_web_contents_) == NULL) 1031 if (chrome::FindBrowserWithWebContents(source_web_contents_) == NULL)
1032 return false; 1032 return false;
1033 return true; 1033 return true;
1034 1034
1035 case IDC_CONTENT_CONTEXT_TRANSLATE: { 1035 case IDC_CONTENT_CONTEXT_TRANSLATE: {
1036 TranslateTabHelper* translate_tab_helper = 1036 TranslateTabHelper* translate_tab_helper =
1037 TranslateTabHelper::FromWebContents(source_web_contents_); 1037 TranslateTabHelper::FromWebContents(source_web_contents_);
1038 if (!translate_tab_helper) 1038 if (!translate_tab_helper)
1039 return false; 1039 return false;
1040 std::string original_lang = 1040 std::string original_lang =
1041 translate_tab_helper->language_state().original_language(); 1041 translate_tab_helper->language_state().original_language();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 (params_.media_type == WebContextMenuData::MediaTypeNone || 1211 (params_.media_type == WebContextMenuData::MediaTypeNone ||
1212 params_.media_flags & WebContextMenuData::MediaCanPrint); 1212 params_.media_flags & WebContextMenuData::MediaCanPrint);
1213 1213
1214 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: 1214 case IDC_CONTENT_CONTEXT_SEARCHWEBFOR:
1215 case IDC_CONTENT_CONTEXT_GOTOURL: 1215 case IDC_CONTENT_CONTEXT_GOTOURL:
1216 case IDC_SPELLPANEL_TOGGLE: 1216 case IDC_SPELLPANEL_TOGGLE:
1217 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: 1217 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS:
1218 return true; 1218 return true;
1219 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: 1219 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO:
1220 // Disabled if no browser is associated (e.g. desktop notifications). 1220 // Disabled if no browser is associated (e.g. desktop notifications).
1221 if (browser::FindBrowserWithWebContents(source_web_contents_) == NULL) 1221 if (chrome::FindBrowserWithWebContents(source_web_contents_) == NULL)
1222 return false; 1222 return false;
1223 return true; 1223 return true;
1224 1224
1225 case IDC_CHECK_SPELLING_WHILE_TYPING: 1225 case IDC_CHECK_SPELLING_WHILE_TYPING:
1226 return profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); 1226 return profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck);
1227 1227
1228 #if !defined(OS_MACOSX) && defined(OS_POSIX) 1228 #if !defined(OS_MACOSX) && defined(OS_POSIX)
1229 // TODO(suzhe): this should not be enabled for password fields. 1229 // TODO(suzhe): this should not be enabled for password fields.
1230 case IDC_INPUT_METHODS_MENU: 1230 case IDC_INPUT_METHODS_MENU:
1231 return true; 1231 return true;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url, 1346 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
1347 params_.frame_id, 1347 params_.frame_id,
1348 disposition, 1348 disposition,
1349 content::PAGE_TRANSITION_LINK); 1349 content::PAGE_TRANSITION_LINK);
1350 return; 1350 return;
1351 } 1351 }
1352 1352
1353 switch (id) { 1353 switch (id) {
1354 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: { 1354 case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: {
1355 Browser* browser = 1355 Browser* browser =
1356 browser::FindBrowserWithWebContents(source_web_contents_); 1356 chrome::FindBrowserWithWebContents(source_web_contents_);
1357 OpenURL( 1357 OpenURL(
1358 params_.link_url, 1358 params_.link_url,
1359 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url, 1359 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url,
1360 params_.frame_id, 1360 params_.frame_id,
1361 !browser || browser->is_app() ? 1361 !browser || browser->is_app() ?
1362 NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB, 1362 NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB,
1363 content::PAGE_TRANSITION_LINK); 1363 content::PAGE_TRANSITION_LINK);
1364 break; 1364 break;
1365 } 1365 }
1366 case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW: 1366 case IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 1578
1579 extensions::ExtensionSystem::Get(profile_)->extension_service()-> 1579 extensions::ExtensionSystem::Get(profile_)->extension_service()->
1580 InspectBackgroundPage(platform_app); 1580 InspectBackgroundPage(platform_app);
1581 break; 1581 break;
1582 } 1582 }
1583 1583
1584 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { 1584 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: {
1585 NavigationController* controller = &source_web_contents_->GetController(); 1585 NavigationController* controller = &source_web_contents_->GetController();
1586 NavigationEntry* nav_entry = controller->GetActiveEntry(); 1586 NavigationEntry* nav_entry = controller->GetActiveEntry();
1587 Browser* browser = 1587 Browser* browser =
1588 browser::FindBrowserWithWebContents(source_web_contents_); 1588 chrome::FindBrowserWithWebContents(source_web_contents_);
1589 chrome::ShowPageInfo(browser, source_web_contents_, nav_entry->GetURL(), 1589 chrome::ShowPageInfo(browser, source_web_contents_, nav_entry->GetURL(),
1590 nav_entry->GetSSL(), true); 1590 nav_entry->GetSSL(), true);
1591 break; 1591 break;
1592 } 1592 }
1593 1593
1594 case IDC_CONTENT_CONTEXT_TRANSLATE: { 1594 case IDC_CONTENT_CONTEXT_TRANSLATE: {
1595 // A translation might have been triggered by the time the menu got 1595 // A translation might have been triggered by the time the menu got
1596 // selected, do nothing in that case. 1596 // selected, do nothing in that case.
1597 TranslateTabHelper* translate_tab_helper = 1597 TranslateTabHelper* translate_tab_helper =
1598 TranslateTabHelper::FromWebContents(source_web_contents_); 1598 TranslateTabHelper::FromWebContents(source_web_contents_);
(...skipping 19 matching lines...) Expand all
1618 case IDC_CONTENT_CONTEXT_RELOADFRAME: 1618 case IDC_CONTENT_CONTEXT_RELOADFRAME:
1619 rvh->ReloadFrame(); 1619 rvh->ReloadFrame();
1620 break; 1620 break;
1621 1621
1622 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: 1622 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE:
1623 source_web_contents_->ViewFrameSource(params_.frame_url, 1623 source_web_contents_->ViewFrameSource(params_.frame_url,
1624 params_.frame_content_state); 1624 params_.frame_content_state);
1625 break; 1625 break;
1626 1626
1627 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: { 1627 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: {
1628 Browser* browser = browser::FindBrowserWithWebContents( 1628 Browser* browser = chrome::FindBrowserWithWebContents(
1629 source_web_contents_); 1629 source_web_contents_);
1630 chrome::ShowPageInfo(browser, source_web_contents_, params_.frame_url, 1630 chrome::ShowPageInfo(browser, source_web_contents_, params_.frame_url,
1631 params_.security_info, false); 1631 params_.security_info, false);
1632 break; 1632 break;
1633 } 1633 }
1634 1634
1635 case IDC_CONTENT_CONTEXT_UNDO: 1635 case IDC_CONTENT_CONTEXT_UNDO:
1636 rvh->Undo(); 1636 rvh->Undo();
1637 break; 1637 break;
1638 1638
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 source_web_contents_->GetRenderViewHost()-> 1857 source_web_contents_->GetRenderViewHost()->
1858 ExecuteMediaPlayerActionAtLocation(location, action); 1858 ExecuteMediaPlayerActionAtLocation(location, action);
1859 } 1859 }
1860 1860
1861 void RenderViewContextMenu::PluginActionAt( 1861 void RenderViewContextMenu::PluginActionAt(
1862 const gfx::Point& location, 1862 const gfx::Point& location,
1863 const WebPluginAction& action) { 1863 const WebPluginAction& action) {
1864 source_web_contents_->GetRenderViewHost()-> 1864 source_web_contents_->GetRenderViewHost()->
1865 ExecutePluginActionAtLocation(location, action); 1865 ExecutePluginActionAtLocation(location, action);
1866 } 1866 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698