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

Unified Diff: chrome/browser/ui/views/browser_bubble_gtk.cc

Issue 7015051: Re-land: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/browser_bubble.cc ('k') | chrome/browser/ui/views/browser_bubble_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/browser_bubble_gtk.cc
===================================================================
--- chrome/browser/ui/views/browser_bubble_gtk.cc (revision 85284)
+++ chrome/browser/ui/views/browser_bubble_gtk.cc (working copy)
@@ -23,7 +23,8 @@
class BubbleWidget : public views::WidgetGtk {
public:
BubbleWidget(BrowserBubble* bubble, const gfx::Insets& content_margins)
- : bubble_(bubble),
+ : views::WidgetGtk(new views::Widget),
+ bubble_(bubble),
border_contents_(new BorderContents) {
border_contents_->Init();
border_contents_->set_content_margins(content_margins);
@@ -47,7 +48,7 @@
}
virtual void Hide() {
- if (IsActive()&& bubble_) {
+ if (IsActive() && bubble_) {
BrowserBubble::Delegate* delegate = bubble_->delegate();
if (delegate)
delegate->BubbleLostFocus(bubble_, false);
@@ -92,18 +93,19 @@
void BrowserBubble::InitPopup(const gfx::Insets& content_margins) {
// TODO(port)
- BubbleWidget* pop = new BubbleWidget(this, content_margins);
- pop->MakeTransparent();
- pop->make_transient_to_parent();
+ BubbleWidget* bubble_widget = new BubbleWidget(this, content_margins);
+ popup_ = bubble_widget->GetWidget();
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+ params.transparent = true;
params.parent = frame_->GetNativeView();
- pop->Init(params);
+ params.native_widget = bubble_widget;
+ popup_->Init(params);
#if defined(OS_CHROMEOS)
{
vector<int> params;
params.push_back(0); // don't show while screen is locked
chromeos::WmIpc::instance()->SetWindowType(
- pop->GetNativeView(),
+ popup_->GetNativeView(),
chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
&params);
}
@@ -115,42 +117,32 @@
// that when |contents| gets added, it will already have a widget, and thus
// any NativeButtons it creates in ViewHierarchyChanged() will be functional
// (e.g. calling SetChecked() on checkboxes is safe).
- pop->SetContentsView(contents_view);
+ popup_->SetContentsView(contents_view);
// Added border_contents before |view_| so it will paint under it.
- contents_view->AddChildView(pop->border_contents());
+ contents_view->AddChildView(bubble_widget->border_contents());
contents_view->AddChildView(view_);
- popup_ = pop;
-
ResizeToView();
Reposition();
AttachToBrowser();
}
-void BrowserBubble::MovePopup(int x, int y, int w, int h) {
- views::WidgetGtk* pop = static_cast<views::WidgetGtk*>(popup_);
- pop->SetBounds(gfx::Rect(x, y, w, h));
-}
-
void BrowserBubble::Show(bool activate) {
- if (visible_)
- return;
- static_cast<BubbleWidget*>(popup_)->ShowAndActivate(activate);
- visible_ = true;
+ if (!popup_->IsVisible()) {
+ static_cast<BubbleWidget*>(popup_->native_widget())->ShowAndActivate(
+ activate);
+ }
}
void BrowserBubble::Hide() {
- if (!visible_)
- return;
- views::WidgetGtk* pop = static_cast<views::WidgetGtk*>(popup_);
- pop->Hide();
- visible_ = false;
+ if (popup_->IsVisible())
+ static_cast<BubbleWidget*>(popup_->native_widget())->Hide();
}
void BrowserBubble::ResizeToView() {
BorderContents* border_contents =
- static_cast<BubbleWidget*>(popup_)->border_contents();
+ static_cast<BubbleWidget*>(popup_->native_widget())->border_contents();
// Calculate and set the bounds for all windows and views.
gfx::Rect window_bounds;
« no previous file with comments | « chrome/browser/ui/views/browser_bubble.cc ('k') | chrome/browser/ui/views/browser_bubble_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698