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

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

Issue 331993009: MacViews: Run native Cocoa context menus to support Services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add VIEWS_EXPORT for unit test access Created 6 years, 5 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 (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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/constrained_window_views.h" 8 #include "chrome/browser/ui/views/constrained_window_views.h"
9 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" 9 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h"
10 #include "components/web_modal/web_contents_modal_dialog_manager.h" 10 #include "components/web_modal/web_contents_modal_dialog_manager.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 ShowContextMenu(point, source_type, iter->first); 303 ShowContextMenu(point, source_type, iter->first);
304 return; 304 return;
305 } 305 }
306 } 306 }
307 } 307 }
308 308
309 void MediaGalleriesDialogViews::ShowContextMenu(const gfx::Point& point, 309 void MediaGalleriesDialogViews::ShowContextMenu(const gfx::Point& point,
310 ui::MenuSourceType source_type, 310 ui::MenuSourceType source_type,
311 MediaGalleryPrefId id) { 311 MediaGalleryPrefId id) {
312 context_menu_runner_.reset(new views::MenuRunner( 312 context_menu_runner_.reset(new views::MenuRunner(
313 controller_->GetContextMenu(id))); 313 controller_->GetContextMenu(id),
314 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
314 315
315 if (context_menu_runner_->RunMenuAt( 316 if (context_menu_runner_->RunMenuAt(GetWidget(),
316 GetWidget(), 317 NULL,
317 NULL, 318 gfx::Rect(point.x(), point.y(), 0, 0),
318 gfx::Rect(point.x(), point.y(), 0, 0), 319 views::MENU_ANCHOR_TOPLEFT,
319 views::MENU_ANCHOR_TOPLEFT, 320 source_type) ==
320 source_type,
321 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) ==
322 views::MenuRunner::MENU_DELETED) { 321 views::MenuRunner::MENU_DELETED) {
323 return; 322 return;
324 } 323 }
325 } 324 }
326 325
327 bool MediaGalleriesDialogViews::ControllerHasWebContents() const { 326 bool MediaGalleriesDialogViews::ControllerHasWebContents() const {
328 return controller_->WebContents() != NULL; 327 return controller_->WebContents() != NULL;
329 } 328 }
330 329
331 // MediaGalleriesDialogViewsController ----------------------------------------- 330 // MediaGalleriesDialogViewsController -----------------------------------------
332 331
333 // static 332 // static
334 MediaGalleriesDialog* MediaGalleriesDialog::Create( 333 MediaGalleriesDialog* MediaGalleriesDialog::Create(
335 MediaGalleriesDialogController* controller) { 334 MediaGalleriesDialogController* controller) {
336 return new MediaGalleriesDialogViews(controller); 335 return new MediaGalleriesDialogViews(controller);
337 } 336 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698