| 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/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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "content/public/browser/navigation_details.h" | 72 #include "content/public/browser/navigation_details.h" |
| 73 #include "content/public/browser/navigation_entry.h" | 73 #include "content/public/browser/navigation_entry.h" |
| 74 #include "content/public/browser/notification_service.h" | 74 #include "content/public/browser/notification_service.h" |
| 75 #include "content/public/browser/render_process_host.h" | 75 #include "content/public/browser/render_process_host.h" |
| 76 #include "content/public/browser/render_view_host.h" | 76 #include "content/public/browser/render_view_host.h" |
| 77 #include "content/public/browser/render_widget_host_view.h" | 77 #include "content/public/browser/render_widget_host_view.h" |
| 78 #include "content/public/browser/user_metrics.h" | 78 #include "content/public/browser/user_metrics.h" |
| 79 #include "content/public/browser/web_contents.h" | 79 #include "content/public/browser/web_contents.h" |
| 80 #include "content/public/common/content_restriction.h" | 80 #include "content/public/common/content_restriction.h" |
| 81 #include "content/public/common/ssl_status.h" | 81 #include "content/public/common/ssl_status.h" |
| 82 #include "content/public/common/url_utils.h" |
| 82 #include "extensions/browser/view_type_utils.h" | 83 #include "extensions/browser/view_type_utils.h" |
| 83 #include "grit/generated_resources.h" | 84 #include "grit/generated_resources.h" |
| 84 #include "net/base/escape.h" | 85 #include "net/base/escape.h" |
| 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
| 86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
| 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" | 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" |
| 88 #include "ui/base/clipboard/clipboard.h" | 89 #include "ui/base/clipboard/clipboard.h" |
| 89 #include "ui/base/l10n/l10n_util.h" | 90 #include "ui/base/l10n/l10n_util.h" |
| 90 #include "ui/base/text/text_elider.h" | 91 #include "ui/base/text/text_elider.h" |
| 91 #include "ui/gfx/favicon_size.h" | 92 #include "ui/gfx/favicon_size.h" |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 // Test if file-selection dialogs are forbidden by policy. | 1328 // Test if file-selection dialogs are forbidden by policy. |
| 1328 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) | 1329 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) |
| 1329 return false; | 1330 return false; |
| 1330 | 1331 |
| 1331 // Instead of using GetURL here, we use url() (which is the "real" url of | 1332 // Instead of using GetURL here, we use url() (which is the "real" url of |
| 1332 // the page) from the NavigationEntry because its reflects their origin | 1333 // the page) from the NavigationEntry because its reflects their origin |
| 1333 // rather than the display one (returned by GetURL) which may be | 1334 // rather than the display one (returned by GetURL) which may be |
| 1334 // different (like having "view-source:" on the front). | 1335 // different (like having "view-source:" on the front). |
| 1335 NavigationEntry* active_entry = | 1336 NavigationEntry* active_entry = |
| 1336 source_web_contents_->GetController().GetActiveEntry(); | 1337 source_web_contents_->GetController().GetActiveEntry(); |
| 1337 return download_util::IsSavableURL( | 1338 return content::IsSavableURL( |
| 1338 (active_entry) ? active_entry->GetURL() : GURL()); | 1339 (active_entry) ? active_entry->GetURL() : GURL()); |
| 1339 } | 1340 } |
| 1340 | 1341 |
| 1341 case IDC_CONTENT_CONTEXT_RELOADFRAME: | 1342 case IDC_CONTENT_CONTEXT_RELOADFRAME: |
| 1342 return params_.frame_url.is_valid(); | 1343 return params_.frame_url.is_valid(); |
| 1343 | 1344 |
| 1344 case IDC_CONTENT_CONTEXT_UNDO: | 1345 case IDC_CONTENT_CONTEXT_UNDO: |
| 1345 return !!(params_.edit_flags & WebContextMenuData::CanUndo); | 1346 return !!(params_.edit_flags & WebContextMenuData::CanUndo); |
| 1346 | 1347 |
| 1347 case IDC_CONTENT_CONTEXT_REDO: | 1348 case IDC_CONTENT_CONTEXT_REDO: |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 source_web_contents_->GetRenderViewHost()-> | 2047 source_web_contents_->GetRenderViewHost()-> |
| 2047 ExecuteMediaPlayerActionAtLocation(location, action); | 2048 ExecuteMediaPlayerActionAtLocation(location, action); |
| 2048 } | 2049 } |
| 2049 | 2050 |
| 2050 void RenderViewContextMenu::PluginActionAt( | 2051 void RenderViewContextMenu::PluginActionAt( |
| 2051 const gfx::Point& location, | 2052 const gfx::Point& location, |
| 2052 const WebPluginAction& action) { | 2053 const WebPluginAction& action) { |
| 2053 source_web_contents_->GetRenderViewHost()-> | 2054 source_web_contents_->GetRenderViewHost()-> |
| 2054 ExecutePluginActionAtLocation(location, action); | 2055 ExecutePluginActionAtLocation(location, action); |
| 2055 } | 2056 } |
| OLD | NEW |