| 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 "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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 if (source->IsVisibleAt(i) && | 326 if (source->IsVisibleAt(i) && |
| 327 source->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) { | 327 source->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR) { |
| 328 RecordShownItem(source->GetCommandIdAt(i)); | 328 RecordShownItem(source->GetCommandIdAt(i)); |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 // Ignore notifications from submenus. | 332 // Ignore notifications from submenus. |
| 333 if (source != &menu_model_) | 333 if (source != &menu_model_) |
| 334 return; | 334 return; |
| 335 | 335 |
| 336 content::RenderWidgetHostView* view = | 336 source_web_contents_->SetShowingContextMenu(true); |
| 337 source_web_contents_->GetRenderWidgetHostView(); | |
| 338 if (view) | |
| 339 view->SetShowingContextMenu(true); | |
| 340 | 337 |
| 341 NotifyMenuShown(); | 338 NotifyMenuShown(); |
| 342 } | 339 } |
| 343 | 340 |
| 344 void RenderViewContextMenuBase::MenuClosed(ui::SimpleMenuModel* source) { | 341 void RenderViewContextMenuBase::MenuClosed(ui::SimpleMenuModel* source) { |
| 345 // Ignore notifications from submenus. | 342 // Ignore notifications from submenus. |
| 346 if (source != &menu_model_) | 343 if (source != &menu_model_) |
| 347 return; | 344 return; |
| 348 | 345 |
| 349 content::RenderWidgetHostView* view = | 346 source_web_contents_->SetShowingContextMenu(false); |
| 350 source_web_contents_->GetRenderWidgetHostView(); | |
| 351 if (view) | |
| 352 view->SetShowingContextMenu(false); | |
| 353 source_web_contents_->NotifyContextMenuClosed(params_.custom_context); | 347 source_web_contents_->NotifyContextMenuClosed(params_.custom_context); |
| 354 } | 348 } |
| 355 | 349 |
| 356 RenderFrameHost* RenderViewContextMenuBase::GetRenderFrameHost() { | 350 RenderFrameHost* RenderViewContextMenuBase::GetRenderFrameHost() { |
| 357 return RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 351 return RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 358 } | 352 } |
| 359 | 353 |
| 360 // Controller functions -------------------------------------------------------- | 354 // Controller functions -------------------------------------------------------- |
| 361 | 355 |
| 362 void RenderViewContextMenuBase::OpenURL(const GURL& url, | 356 void RenderViewContextMenuBase::OpenURL(const GURL& url, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 source_web_contents_->OpenURL(open_url_params); | 388 source_web_contents_->OpenURL(open_url_params); |
| 395 } | 389 } |
| 396 | 390 |
| 397 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { | 391 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { |
| 398 return IsCustomItemCheckedInternal(params_.custom_items, id); | 392 return IsCustomItemCheckedInternal(params_.custom_items, id); |
| 399 } | 393 } |
| 400 | 394 |
| 401 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { | 395 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { |
| 402 return IsCustomItemEnabledInternal(params_.custom_items, id); | 396 return IsCustomItemEnabledInternal(params_.custom_items, id); |
| 403 } | 397 } |
| OLD | NEW |