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

Side by Side Diff: chrome/browser/chromeos/frame/bubble_window.cc

Issue 7850026: Aura under Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: White spaces Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/frame/bubble_window.h" 5 #include "chrome/browser/chromeos/frame/bubble_window.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "chrome/browser/chromeos/frame/bubble_frame_view.h" 9 #include "chrome/browser/chromeos/frame/bubble_frame_view.h"
10 #include "chrome/browser/chromeos/frame/bubble_window_views.h" 10 #include "chrome/browser/chromeos/frame/bubble_window_views.h"
11 #include "ui/gfx/skia_utils_gtk.h" 11 #include "ui/gfx/skia_utils_gtk.h"
12 #include "views/window/non_client_view.h" 12 #include "views/window/non_client_view.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 BubbleWindow::BubbleWindow(views::Widget* window, 16 BubbleWindow::BubbleWindow(views::Widget* window,
17 BubbleWindowStyle style) 17 BubbleWindowStyle style)
18 : views::NativeWidgetGtk(window), 18 : views::NativeWidgetGtk(window),
19 style_(style) { 19 style_(style) {
20 } 20 }
21 21
22 void BubbleWindow::InitNativeWidget(const views::Widget::InitParams& params) { 22 void BubbleWindow::InitNativeWidget(const views::Widget::InitParams& params) {
23 #if defined(USE_AURA)
24 // TODO(saintlou): Switch to alicet@chromium.org PureView when landed
25 #else
23 views::NativeWidgetGtk::InitNativeWidget(params); 26 views::NativeWidgetGtk::InitNativeWidget(params);
24 27
25 // Turn on double buffering so that the hosted GtkWidgets does not 28 // Turn on double buffering so that the hosted GtkWidgets does not
26 // flash as in http://crosbug.com/9065. 29 // flash as in http://crosbug.com/9065.
27 EnableDoubleBuffer(true); 30 EnableDoubleBuffer(true);
28 31
29 GdkColor background_color = 32 GdkColor background_color =
30 gfx::SkColorToGdkColor(kBubbleWindowBackgroundColor); 33 gfx::SkColorToGdkColor(kBubbleWindowBackgroundColor);
31 gtk_widget_modify_bg(GetNativeView(), GTK_STATE_NORMAL, &background_color); 34 gtk_widget_modify_bg(GetNativeView(), GTK_STATE_NORMAL, &background_color);
32 35
33 // A work-around for http://crosbug.com/8538. All GdkWindow of top-level 36 // A work-around for http://crosbug.com/8538. All GdkWindow of top-level
34 // GtkWindow should participate _NET_WM_SYNC_REQUEST protocol and window 37 // GtkWindow should participate _NET_WM_SYNC_REQUEST protocol and window
35 // manager should only show the window after getting notified. And we 38 // manager should only show the window after getting notified. And we
36 // should only notify window manager after at least one paint is done. 39 // should only notify window manager after at least one paint is done.
37 // TODO(xiyuan): Figure out the right fix. 40 // TODO(xiyuan): Figure out the right fix.
38 gtk_widget_realize(GetNativeView()); 41 gtk_widget_realize(GetNativeView());
39 gdk_window_set_back_pixmap(GetNativeView()->window, NULL, FALSE); 42 gdk_window_set_back_pixmap(GetNativeView()->window, NULL, FALSE);
40 gtk_widget_realize(window_contents()); 43 gtk_widget_realize(window_contents());
41 gdk_window_set_back_pixmap(window_contents()->window, NULL, FALSE); 44 gdk_window_set_back_pixmap(window_contents()->window, NULL, FALSE);
45 #endif
42 } 46 }
43 47
44 views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() { 48 views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() {
45 views::Widget* window = GetWidget(); 49 views::Widget* window = GetWidget();
46 return new BubbleFrameView(window, window->widget_delegate(), style_); 50 return new BubbleFrameView(window, window->widget_delegate(), style_);
47 } 51 }
48 52
49 views::Widget* BubbleWindow::Create( 53 views::Widget* BubbleWindow::Create(
50 gfx::NativeWindow parent, 54 gfx::NativeWindow parent,
51 BubbleWindowStyle style, 55 BubbleWindowStyle style,
52 views::WidgetDelegate* widget_delegate) { 56 views::WidgetDelegate* widget_delegate) {
57 #if defined(USE_AURA)
58 // TODO(saintlou):
59 return NULL;
60 #else
53 // TODO(saintlou): Ultimately we do not want 2 classes for BubbleWindows. 61 // TODO(saintlou): Ultimately we do not want 2 classes for BubbleWindows.
54 // Furthermore the 2 other styles (STYLE_XBAR & STYLE_THROBBER) are only used 62 // Furthermore the 2 other styles (STYLE_XBAR & STYLE_THROBBER) are only used
55 // in LoginHtmlDialog::Show() which will be deprecated soon. 63 // in LoginHtmlDialog::Show() which will be deprecated soon.
56 if (views::Widget::IsPureViews()) { 64 if (views::Widget::IsPureViews()) {
57 if ((style & STYLE_XBAR) || (style & STYLE_THROBBER)) 65 if ((style & STYLE_XBAR) || (style & STYLE_THROBBER))
58 NOTIMPLEMENTED(); 66 NOTIMPLEMENTED();
59 BubbleWindowViews* window = new BubbleWindowViews(style); 67 BubbleWindowViews* window = new BubbleWindowViews(style);
60 views::Widget::InitParams params; 68 views::Widget::InitParams params;
61 params.delegate = widget_delegate; 69 params.delegate = widget_delegate;
62 params.parent = GTK_WIDGET(parent); 70 params.parent = GTK_WIDGET(parent);
63 params.bounds = gfx::Rect(); 71 params.bounds = gfx::Rect();
64 params.transparent = true; 72 params.transparent = true;
65 window->Init(params); 73 window->Init(params);
66 window->SetBackgroundColor(); 74 window->SetBackgroundColor();
67 return window; 75 return window;
68 } 76 }
69 77
70 views::Widget* window = new views::Widget; 78 views::Widget* window = new views::Widget;
71 BubbleWindow* bubble_window = new BubbleWindow(window, style); 79 BubbleWindow* bubble_window = new BubbleWindow(window, style);
72 views::Widget::InitParams params; 80 views::Widget::InitParams params;
73 params.delegate = widget_delegate; 81 params.delegate = widget_delegate;
74 params.native_widget = bubble_window; 82 params.native_widget = bubble_window;
75 params.parent = GTK_WIDGET(parent); 83 params.parent = GTK_WIDGET(parent);
76 params.bounds = gfx::Rect(); 84 params.bounds = gfx::Rect();
77 params.transparent = true; 85 params.transparent = true;
78 window->Init(params); 86 window->Init(params);
79 87
80 return window; 88 return window;
89 #endif
81 } 90 }
82 91
83 } // namespace chromeos 92 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698