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

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

Issue 8528009: Renaming bubble_window.cc to bubble_window_gtk.cc (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/frame/bubble_window.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
26 views::NativeWidgetGtk::InitNativeWidget(params); 23 views::NativeWidgetGtk::InitNativeWidget(params);
27 24
28 // Turn on double buffering so that the hosted GtkWidgets does not 25 // Turn on double buffering so that the hosted GtkWidgets does not
29 // flash as in http://crosbug.com/9065. 26 // flash as in http://crosbug.com/9065.
30 EnableDoubleBuffer(true); 27 EnableDoubleBuffer(true);
31 28
32 GdkColor background_color = 29 GdkColor background_color =
33 gfx::SkColorToGdkColor(kBubbleWindowBackgroundColor); 30 gfx::SkColorToGdkColor(kBubbleWindowBackgroundColor);
34 gtk_widget_modify_bg(GetNativeView(), GTK_STATE_NORMAL, &background_color); 31 gtk_widget_modify_bg(GetNativeView(), GTK_STATE_NORMAL, &background_color);
35 32
36 // A work-around for http://crosbug.com/8538. All GdkWindow of top-level 33 // A work-around for http://crosbug.com/8538. All GdkWindow of top-level
37 // GtkWindow should participate _NET_WM_SYNC_REQUEST protocol and window 34 // GtkWindow should participate _NET_WM_SYNC_REQUEST protocol and window
38 // manager should only show the window after getting notified. And we 35 // manager should only show the window after getting notified. And we
39 // should only notify window manager after at least one paint is done. 36 // should only notify window manager after at least one paint is done.
40 // TODO(xiyuan): Figure out the right fix. 37 // TODO(xiyuan): Figure out the right fix.
41 gtk_widget_realize(GetNativeView()); 38 gtk_widget_realize(GetNativeView());
42 gdk_window_set_back_pixmap(GetNativeView()->window, NULL, FALSE); 39 gdk_window_set_back_pixmap(GetNativeView()->window, NULL, FALSE);
43 gtk_widget_realize(window_contents()); 40 gtk_widget_realize(window_contents());
44 gdk_window_set_back_pixmap(window_contents()->window, NULL, FALSE); 41 gdk_window_set_back_pixmap(window_contents()->window, NULL, FALSE);
45 #endif
46 } 42 }
47 43
48 views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() { 44 views::NonClientFrameView* BubbleWindow::CreateNonClientFrameView() {
49 views::Widget* window = GetWidget(); 45 views::Widget* window = GetWidget();
50 return new BubbleFrameView(window, window->widget_delegate(), style_); 46 return new BubbleFrameView(window, window->widget_delegate(), style_);
51 } 47 }
52 48
53 views::Widget* BubbleWindow::Create( 49 views::Widget* BubbleWindow::Create(
54 gfx::NativeWindow parent, 50 gfx::NativeWindow parent,
55 BubbleWindowStyle style, 51 BubbleWindowStyle style,
56 views::WidgetDelegate* widget_delegate) { 52 views::WidgetDelegate* widget_delegate) {
57 #if defined(USE_AURA)
58 // TODO(saintlou):
59 return NULL;
60 #else
61 // TODO(saintlou): Ultimately we do not want 2 classes for BubbleWindows.
62 // Furthermore the 2 other styles (STYLE_XBAR & STYLE_THROBBER) are only used
63 // in LoginHtmlDialog::Show() which will be deprecated soon.
64 if (views::Widget::IsPureViews()) {
65 if ((style & STYLE_XBAR) || (style & STYLE_THROBBER))
66 NOTIMPLEMENTED();
67 BubbleWindowViews* window = new BubbleWindowViews(style);
68 views::Widget::InitParams params;
69 params.delegate = widget_delegate;
70 params.parent = GTK_WIDGET(parent);
71 params.bounds = gfx::Rect();
72 window->Init(params);
73 window->SetBackgroundColor();
74 return window;
75 }
76
77 views::Widget* window = new views::Widget; 53 views::Widget* window = new views::Widget;
78 BubbleWindow* bubble_window = new BubbleWindow(window, style); 54 BubbleWindow* bubble_window = new BubbleWindow(window, style);
79 views::Widget::InitParams params; 55 views::Widget::InitParams params;
80 params.delegate = widget_delegate; 56 params.delegate = widget_delegate;
81 params.native_widget = bubble_window; 57 params.native_widget = bubble_window;
82 params.parent = GTK_WIDGET(parent); 58 params.parent = GTK_WIDGET(parent);
83 params.bounds = gfx::Rect(); 59 params.bounds = gfx::Rect();
84 window->Init(params); 60 window->Init(params);
85 61
86 return window; 62 return window;
87 #endif
88 } 63 }
89 64
90 } // namespace chromeos 65 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/frame/bubble_window.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698