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

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

Issue 22831005: Use visible entry for website settings dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TabSpecificContentSettings Created 7 years, 4 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tab_contents/render_view_context_menu.h" 5 #include "chrome/browser/tab_contents/render_view_context_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 PrefService* local_state = g_browser_process->local_state(); 1343 PrefService* local_state = g_browser_process->local_state();
1344 DCHECK(local_state); 1344 DCHECK(local_state);
1345 // Test if file-selection dialogs are forbidden by policy. 1345 // Test if file-selection dialogs are forbidden by policy.
1346 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) 1346 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs))
1347 return false; 1347 return false;
1348 1348
1349 // Instead of using GetURL here, we use url() (which is the "real" url of 1349 // Instead of using GetURL here, we use url() (which is the "real" url of
1350 // the page) from the NavigationEntry because its reflects their origin 1350 // the page) from the NavigationEntry because its reflects their origin
1351 // rather than the display one (returned by GetURL) which may be 1351 // rather than the display one (returned by GetURL) which may be
1352 // different (like having "view-source:" on the front). 1352 // different (like having "view-source:" on the front).
1353 // TODO(nasko): Audit all GetActiveEntry calls in this file.
1353 NavigationEntry* active_entry = 1354 NavigationEntry* active_entry =
1354 source_web_contents_->GetController().GetActiveEntry(); 1355 source_web_contents_->GetController().GetActiveEntry();
1355 return content::IsSavableURL( 1356 return content::IsSavableURL(
1356 (active_entry) ? active_entry->GetURL() : GURL()); 1357 (active_entry) ? active_entry->GetURL() : GURL());
1357 } 1358 }
1358 1359
1359 case IDC_CONTENT_CONTEXT_RELOADFRAME: 1360 case IDC_CONTENT_CONTEXT_RELOADFRAME:
1360 return params_.frame_url.is_valid(); 1361 return params_.frame_url.is_valid();
1361 1362
1362 case IDC_CONTENT_CONTEXT_UNDO: 1363 case IDC_CONTENT_CONTEXT_UNDO:
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 DCHECK(platform_app); 1765 DCHECK(platform_app);
1765 DCHECK(platform_app->is_platform_app()); 1766 DCHECK(platform_app->is_platform_app());
1766 1767
1767 extensions::ExtensionSystem::Get(profile_)->extension_service()-> 1768 extensions::ExtensionSystem::Get(profile_)->extension_service()->
1768 InspectBackgroundPage(platform_app); 1769 InspectBackgroundPage(platform_app);
1769 break; 1770 break;
1770 } 1771 }
1771 1772
1772 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { 1773 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: {
1773 NavigationController* controller = &source_web_contents_->GetController(); 1774 NavigationController* controller = &source_web_contents_->GetController();
1774 NavigationEntry* nav_entry = controller->GetActiveEntry(); 1775 // Important to use GetVisibleEntry to match what's showing in the
1776 // omnibox.
1777 NavigationEntry* nav_entry = controller->GetVisibleEntry();
1775 Browser* browser = 1778 Browser* browser =
1776 chrome::FindBrowserWithWebContents(source_web_contents_); 1779 chrome::FindBrowserWithWebContents(source_web_contents_);
1777 chrome::ShowWebsiteSettings(browser, source_web_contents_, 1780 chrome::ShowWebsiteSettings(browser, source_web_contents_,
1778 nav_entry->GetURL(), nav_entry->GetSSL()); 1781 nav_entry->GetURL(), nav_entry->GetSSL());
1779 break; 1782 break;
1780 } 1783 }
1781 1784
1782 case IDC_CONTENT_CONTEXT_TRANSLATE: { 1785 case IDC_CONTENT_CONTEXT_TRANSLATE: {
1783 // A translation might have been triggered by the time the menu got 1786 // A translation might have been triggered by the time the menu got
1784 // selected, do nothing in that case. 1787 // selected, do nothing in that case.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 source_web_contents_->GetRenderViewHost()-> 2079 source_web_contents_->GetRenderViewHost()->
2077 ExecuteMediaPlayerActionAtLocation(location, action); 2080 ExecuteMediaPlayerActionAtLocation(location, action);
2078 } 2081 }
2079 2082
2080 void RenderViewContextMenu::PluginActionAt( 2083 void RenderViewContextMenu::PluginActionAt(
2081 const gfx::Point& location, 2084 const gfx::Point& location,
2082 const WebPluginAction& action) { 2085 const WebPluginAction& action) {
2083 source_web_contents_->GetRenderViewHost()-> 2086 source_web_contents_->GetRenderViewHost()->
2084 ExecutePluginActionAtLocation(location, action); 2087 ExecutePluginActionAtLocation(location, action);
2085 } 2088 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698