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

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

Issue 7566023: Enabled BubbleWindowViews class for the Pure Views case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/frame/bubble_window_views.h » ('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 "ui/gfx/skia_utils_gtk.h" 11 #include "ui/gfx/skia_utils_gtk.h"
11 #include "views/window/non_client_view.h" 12 #include "views/window/non_client_view.h"
12 13
13 namespace { 14 namespace {
14 15
15 bool IsInsideCircle(int x0, int y0, int x1, int y1, int r) { 16 bool IsInsideCircle(int x0, int y0, int x1, int y1, int r) {
16 return (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1) <= r * r; 17 return (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1) <= r * r;
17 } 18 }
18 19
19 void SetRegionUnionWithPoint(int i, int j, GdkRegion* region) { 20 void SetRegionUnionWithPoint(int i, int j, GdkRegion* region) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 109
109 gdk_window_shape_combine_region(window_contents()->window, region, 110 gdk_window_shape_combine_region(window_contents()->window, region,
110 margin_left, margin_top); 111 margin_left, margin_top);
111 gdk_region_destroy(region); 112 gdk_region_destroy(region);
112 } 113 }
113 114
114 views::Widget* BubbleWindow::Create( 115 views::Widget* BubbleWindow::Create(
115 gfx::NativeWindow parent, 116 gfx::NativeWindow parent,
116 BubbleWindowStyle style, 117 BubbleWindowStyle style,
117 views::WidgetDelegate* widget_delegate) { 118 views::WidgetDelegate* widget_delegate) {
119 // TODO(saintlou): Ultimately we do not want 2 classes for BubbleWindows.
120 // After discussions with mazda@chromium.org we concluded that we could
121 // punt on an initial implementation of the STYLE_XSHAPE style which is only
122 // used when displaying the keyboard overlay. Once we have implemented
123 // gradient and other missing features of Views we can address this.
124 // Furthermore the 2 other styles (STYLE_XBAR & STYLE_THROBBER) are only used
125 // in LoginHtmlDialog::Show() which will be deprecated soon.
126 if (views::Widget::IsPureViews()) {
127 if (style != STYLE_GENERIC)
128 NOTIMPLEMENTED();
129 BubbleWindowViews* window = new BubbleWindowViews(style);
130 views::Widget::InitParams params;
131 params.delegate = widget_delegate;
132 params.parent = GTK_WIDGET(parent);
133 params.bounds = gfx::Rect();
134 params.transparent = true;
135 window->Init(params);
136 window->SetBackgroundColor();
137 return window;
138 }
139
118 views::Widget* window = new views::Widget; 140 views::Widget* window = new views::Widget;
119 BubbleWindow* bubble_window = new BubbleWindow(window, style); 141 BubbleWindow* bubble_window = new BubbleWindow(window, style);
120 views::Widget::InitParams params; 142 views::Widget::InitParams params;
121 params.delegate = widget_delegate; 143 params.delegate = widget_delegate;
122 params.native_widget = bubble_window; 144 params.native_widget = bubble_window;
123 params.parent = GTK_WIDGET(parent); 145 params.parent = GTK_WIDGET(parent);
124 params.bounds = gfx::Rect(); 146 params.bounds = gfx::Rect();
125 params.transparent = true; 147 params.transparent = true;
126 window->Init(params); 148 window->Init(params);
127 149
128 if (style == STYLE_XSHAPE) { 150 if (style == STYLE_XSHAPE) {
129 const int kMarginLeft = 14; 151 const int kMarginLeft = 14;
130 const int kMarginRight = 14; 152 const int kMarginRight = 14;
131 const int kMarginTop = 12; 153 const int kMarginTop = 12;
132 const int kMarginBottom = 16; 154 const int kMarginBottom = 16;
133 const int kBorderRadius = 8; 155 const int kBorderRadius = 8;
134 bubble_window->TrimMargins(kMarginLeft, kMarginRight, kMarginTop, 156 bubble_window->TrimMargins(kMarginLeft, kMarginRight, kMarginTop,
135 kMarginBottom, kBorderRadius); 157 kMarginBottom, kBorderRadius);
136 } 158 }
137 159
138 return window; 160 return window;
139 } 161 }
140 162
141 } // namespace chromeos 163 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/frame/bubble_window_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698