| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/browser_bubble.h" | 5 #include "chrome/browser/views/browser_bubble.h" |
| 6 | 6 |
| 7 #include "chrome/browser/views/frame/browser_view.h" | 7 #include "chrome/browser/views/frame/browser_view.h" |
| 8 #include "views/widget/widget_gtk.h" | 8 #include "views/widget/widget_gtk.h" |
| 9 #include "views/window/window.h" | 9 #include "views/window/window.h" |
| 10 | 10 |
| 11 void BrowserBubble::InitPopup() { | 11 void BrowserBubble::InitPopup() { |
| 12 gfx::NativeView native_view = frame_->GetNativeView(); | 12 gfx::NativeView native_view = frame_->GetNativeView(); |
| 13 gfx::NativeWindow native_window = frame_->GetWindow()->GetNativeWindow(); | 13 gfx::NativeWindow native_window = frame_->GetWindow()->GetNativeWindow(); |
| 14 views::WidgetGtk* pop = new views::WidgetGtk(views::WidgetGtk::TYPE_POPUP); | 14 views::WidgetGtk* pop = new views::WidgetGtk(views::WidgetGtk::TYPE_POPUP); |
| 15 pop->set_delete_on_destroy(false); | 15 pop->set_delete_on_destroy(false); |
| 16 pop->SetOpacity(0xFF); | 16 pop->SetOpacity(0xFF); |
| 17 pop->Init(native_view, bounds_, false); | 17 pop->Init(native_view, bounds_); |
| 18 pop->SetContentsView(view_); | 18 pop->SetContentsView(view_); |
| 19 popup_.reset(pop); | 19 popup_.reset(pop); |
| 20 Reposition(); | 20 Reposition(); |
| 21 | 21 |
| 22 BrowserView* browser_view = | 22 BrowserView* browser_view = |
| 23 BrowserView::GetBrowserViewForNativeWindow(native_window); | 23 BrowserView::GetBrowserViewForNativeWindow(native_window); |
| 24 DCHECK(browser_view); | 24 DCHECK(browser_view); |
| 25 if (browser_view) | 25 if (browser_view) |
| 26 browser_view->AttachBrowserBubble(this); | 26 browser_view->AttachBrowserBubble(this); |
| 27 } | 27 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 visible_ = true; | 39 visible_ = true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void BrowserBubble::Hide() { | 42 void BrowserBubble::Hide() { |
| 43 if (!visible_) | 43 if (!visible_) |
| 44 return; | 44 return; |
| 45 views::WidgetGtk* pop = static_cast<views::WidgetGtk*>(popup_.get()); | 45 views::WidgetGtk* pop = static_cast<views::WidgetGtk*>(popup_.get()); |
| 46 pop->Hide(); | 46 pop->Hide(); |
| 47 visible_ = false; | 47 visible_ = false; |
| 48 } | 48 } |
| OLD | NEW |