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

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 6 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/content_setting_bubble_contents.h" 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // the bubble arbitrarily wide. 48 // the bubble arbitrarily wide.
49 const int kMaxContentsWidth = 500; 49 const int kMaxContentsWidth = 500;
50 50
51 // When we have multiline labels, we should set a minimum width lest we get very 51 // When we have multiline labels, we should set a minimum width lest we get very
52 // narrow bubbles with lots of line-wrapping. 52 // narrow bubbles with lots of line-wrapping.
53 const int kMinMultiLineContentsWidth = 250; 53 const int kMinMultiLineContentsWidth = 250;
54 54
55 // The minimum width of the media menu buttons. 55 // The minimum width of the media menu buttons.
56 const int kMinMediaMenuButtonWidth = 100; 56 const int kMinMediaMenuButtonWidth = 100;
57 57
58 } 58 } // namespace
59 59
60 using content::PluginService; 60 using content::PluginService;
61 using content::WebContents; 61 using content::WebContents;
62 62
63 63
64 // ContentSettingBubbleContents::Favicon -------------------------------------- 64 // ContentSettingBubbleContents::Favicon --------------------------------------
65 65
66 class ContentSettingBubbleContents::Favicon : public views::ImageView { 66 class ContentSettingBubbleContents::Favicon : public views::ImageView {
67 public: 67 public:
68 Favicon(const gfx::Image& image, 68 Favicon(const gfx::Image& image,
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 457
458 menu_runner_.reset(new views::MenuRunner(i->second->menu_model.get())); 458 menu_runner_.reset(new views::MenuRunner(i->second->menu_model.get()));
459 459
460 gfx::Point screen_location; 460 gfx::Point screen_location;
461 views::View::ConvertPointToScreen(i->first, &screen_location); 461 views::View::ConvertPointToScreen(i->first, &screen_location);
462 ignore_result(menu_runner_->RunMenuAt( 462 ignore_result(menu_runner_->RunMenuAt(
463 source->GetWidget(), 463 source->GetWidget(),
464 i->first, 464 i->first,
465 gfx::Rect(screen_location, i->first->size()), 465 gfx::Rect(screen_location, i->first->size()),
466 views::MenuItemView::TOPLEFT, 466 views::MenuItemView::TOPLEFT,
467 ui::MENU_SOURCE_NONE,
467 views::MenuRunner::HAS_MNEMONICS)); 468 views::MenuRunner::HAS_MNEMONICS));
468 } 469 }
469 470
470 void ContentSettingBubbleContents::Observe( 471 void ContentSettingBubbleContents::Observe(
471 int type, 472 int type,
472 const content::NotificationSource& source, 473 const content::NotificationSource& source,
473 const content::NotificationDetails& details) { 474 const content::NotificationDetails& details) {
474 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); 475 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type);
475 DCHECK(source == content::Source<WebContents>(web_contents_)); 476 DCHECK(source == content::Source<WebContents>(web_contents_));
476 web_contents_ = NULL; 477 web_contents_ = NULL;
477 } 478 }
478 479
479 int ContentSettingBubbleContents::GetPreferredMediaMenuWidth( 480 int ContentSettingBubbleContents::GetPreferredMediaMenuWidth(
480 views::MenuButton* button, 481 views::MenuButton* button,
481 ui::SimpleMenuModel* menu_model) { 482 ui::SimpleMenuModel* menu_model) {
482 string16 title = button->text(); 483 string16 title = button->text();
483 484
484 int width = button->GetPreferredSize().width(); 485 int width = button->GetPreferredSize().width();
485 for (int i = 0; i < menu_model->GetItemCount(); ++i) { 486 for (int i = 0; i < menu_model->GetItemCount(); ++i) {
486 button->SetText(menu_model->GetLabelAt(i)); 487 button->SetText(menu_model->GetLabelAt(i));
487 width = std::max(width, button->GetPreferredSize().width()); 488 width = std::max(width, button->GetPreferredSize().width());
488 } 489 }
489 490
490 // Recover the title for the menu button. 491 // Recover the title for the menu button.
491 button->SetText(title); 492 button->SetText(title);
492 return width; 493 return width;
493 } 494 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_action_view.cc ('k') | chrome/browser/ui/views/download/download_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698