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

Side by Side Diff: chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 years, 8 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
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 "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" 5 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return; 295 return;
296 } 296 }
297 } 297 }
298 } 298 }
299 299
300 void MediaGalleriesDialogViews::ShowContextMenu(const gfx::Point& point, 300 void MediaGalleriesDialogViews::ShowContextMenu(const gfx::Point& point,
301 ui::MenuSourceType source_type, 301 ui::MenuSourceType source_type,
302 MediaGalleryPrefId id) { 302 MediaGalleryPrefId id) {
303 context_menu_runner_.reset(new views::MenuRunner( 303 context_menu_runner_.reset(new views::MenuRunner(
304 controller_->GetContextMenu(id), 304 controller_->GetContextMenu(id),
305 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU | 305 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU,
306 views::MenuRunner::ASYNC,
307 base::Bind(&MediaGalleriesDialogViews::OnMenuClosed, 306 base::Bind(&MediaGalleriesDialogViews::OnMenuClosed,
308 base::Unretained(this)))); 307 base::Unretained(this))));
309 308
310 context_menu_runner_->RunMenuAt(GetWidget(), NULL, 309 context_menu_runner_->RunMenuAt(GetWidget(), NULL,
311 gfx::Rect(point.x(), point.y(), 0, 0), 310 gfx::Rect(point.x(), point.y(), 0, 0),
312 views::MENU_ANCHOR_TOPLEFT, source_type); 311 views::MENU_ANCHOR_TOPLEFT, source_type);
313 } 312 }
314 313
315 bool MediaGalleriesDialogViews::ControllerHasWebContents() const { 314 bool MediaGalleriesDialogViews::ControllerHasWebContents() const {
316 return controller_->WebContents() != NULL; 315 return controller_->WebContents() != NULL;
317 } 316 }
318 317
319 void MediaGalleriesDialogViews::OnMenuClosed() { 318 void MediaGalleriesDialogViews::OnMenuClosed() {
320 context_menu_runner_.reset(); 319 context_menu_runner_.reset();
321 } 320 }
322 321
323 // MediaGalleriesDialogViewsController ----------------------------------------- 322 // MediaGalleriesDialogViewsController -----------------------------------------
324 323
325 // static 324 // static
326 MediaGalleriesDialog* MediaGalleriesDialog::Create( 325 MediaGalleriesDialog* MediaGalleriesDialog::Create(
327 MediaGalleriesDialogController* controller) { 326 MediaGalleriesDialogController* controller) {
328 return new MediaGalleriesDialogViews(controller); 327 return new MediaGalleriesDialogViews(controller);
329 } 328 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_context_menu_view.cc ('k') | chrome/browser/ui/views/frame/browser_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698