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

Side by Side Diff: components/renderer_context_menu/render_view_context_menu_base.cc

Issue 541753003: Use stored render_frame_id_ instead of using GetRenderFrameHost(), as it may return NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « components/renderer_context_menu/render_view_context_menu_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/renderer_context_menu/render_view_context_menu_base.h" 5 #include "components/renderer_context_menu/render_view_context_menu_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 id <= content_context_custom_last; 154 id <= content_context_custom_last;
155 } 155 }
156 156
157 RenderViewContextMenuBase::RenderViewContextMenuBase( 157 RenderViewContextMenuBase::RenderViewContextMenuBase(
158 content::RenderFrameHost* render_frame_host, 158 content::RenderFrameHost* render_frame_host,
159 const content::ContextMenuParams& params) 159 const content::ContextMenuParams& params)
160 : params_(params), 160 : params_(params),
161 source_web_contents_(WebContents::FromRenderFrameHost(render_frame_host)), 161 source_web_contents_(WebContents::FromRenderFrameHost(render_frame_host)),
162 browser_context_(source_web_contents_->GetBrowserContext()), 162 browser_context_(source_web_contents_->GetBrowserContext()),
163 menu_model_(this), 163 menu_model_(this),
164 render_frame_id_(render_frame_host->GetRoutingID()),
164 command_executed_(false), 165 command_executed_(false),
165 render_process_id_(render_frame_host->GetProcess()->GetID()), 166 render_process_id_(render_frame_host->GetProcess()->GetID()) {
166 render_frame_id_(render_frame_host->GetRoutingID()) {
167 } 167 }
168 168
169 RenderViewContextMenuBase::~RenderViewContextMenuBase() { 169 RenderViewContextMenuBase::~RenderViewContextMenuBase() {
170 } 170 }
171 171
172 // Menu construction functions ------------------------------------------------- 172 // Menu construction functions -------------------------------------------------
173 173
174 void RenderViewContextMenuBase::Init() { 174 void RenderViewContextMenuBase::Init() {
175 // Command id range must have been already initializerd. 175 // Command id range must have been already initializerd.
176 DCHECK_NE(-1, content_context_custom_first); 176 DCHECK_NE(-1, content_context_custom_first);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 385
386 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { 386 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const {
387 return IsCustomItemCheckedInternal(params_.custom_items, id); 387 return IsCustomItemCheckedInternal(params_.custom_items, id);
388 } 388 }
389 389
390 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { 390 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const {
391 return IsCustomItemEnabledInternal(params_.custom_items, id); 391 return IsCustomItemEnabledInternal(params_.custom_items, id);
392 } 392 }
393 393
OLDNEW
« no previous file with comments | « components/renderer_context_menu/render_view_context_menu_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698