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

Side by Side Diff: chrome/browser/ui/views/bubble/bubble.cc

Issue 8402031: aura: Initialize Widget to avoid a crash when showing bubbles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/ui/views/bubble/bubble.h" 5 #include "chrome/browser/ui/views/bubble/bubble.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "chrome/browser/ui/views/bubble/border_contents.h" 9 #include "chrome/browser/ui/views/bubble/border_contents.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 views::View* contents, 196 views::View* contents,
197 BubbleDelegate* delegate) { 197 BubbleDelegate* delegate) {
198 delegate_ = delegate; 198 delegate_ = delegate;
199 position_relative_to_ = position_relative_to; 199 position_relative_to_ = position_relative_to;
200 arrow_location_ = arrow_location; 200 arrow_location_ = arrow_location;
201 contents_ = contents; 201 contents_ = contents;
202 const bool fade_in = delegate_ && delegate_->FadeInOnShow(); 202 const bool fade_in = delegate_ && delegate_->FadeInOnShow();
203 203
204 // Create the main window. 204 // Create the main window.
205 #if defined(USE_AURA) 205 #if defined(USE_AURA)
206 // TODO(beng): 206 views::Widget::InitParams params;
207 NOTIMPLEMENTED(); 207 params.transparent = true;
208 params.parent_widget = parent;
209 params.native_widget = this;
210 GetWidget()->Init(params);
211 if (fade_in)
212 SetOpacity(0);
sadrul 2011/10/27 16:14:51 Are there more things to do here? Should I leave t
Ben Goodger (Google) 2011/10/27 16:16:38 Probably leave the TODO & the notimplemented. alic
sadrul 2011/10/27 16:29:50 Added back the TODO and NOTIMPLEMENTED, and an exp
208 #elif defined(OS_WIN) 213 #elif defined(OS_WIN)
209 views::Widget* parent_window = parent->GetTopLevelWidget(); 214 views::Widget* parent_window = parent->GetTopLevelWidget();
210 if (parent_window) 215 if (parent_window)
211 parent_window->DisableInactiveRendering(); 216 parent_window->DisableInactiveRendering();
212 set_window_style(WS_POPUP | WS_CLIPCHILDREN); 217 set_window_style(WS_POPUP | WS_CLIPCHILDREN);
213 int extended_style = WS_EX_TOOLWINDOW; 218 int extended_style = WS_EX_TOOLWINDOW;
214 // During FadeIn we need to turn on the layered window style to deal with 219 // During FadeIn we need to turn on the layered window style to deal with
215 // transparency. This flag needs to be reset after fading in is complete. 220 // transparency. This flag needs to be reset after fading in is complete.
216 if (fade_in) 221 if (fade_in)
217 extended_style |= WS_EX_LAYERED; 222 extended_style |= WS_EX_LAYERED;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // |contents_view| has no layout manager, so we have to explicitly position 305 // |contents_view| has no layout manager, so we have to explicitly position
301 // its children. 306 // its children.
302 border_contents_->SetBoundsRect( 307 border_contents_->SetBoundsRect(
303 gfx::Rect(gfx::Point(), window_bounds.size())); 308 gfx::Rect(gfx::Point(), window_bounds.size()));
304 contents->SetBoundsRect(contents_bounds); 309 contents->SetBoundsRect(contents_bounds);
305 #endif 310 #endif
306 GetWidget()->SetBounds(window_bounds); 311 GetWidget()->SetBounds(window_bounds);
307 312
308 // Show the window. 313 // Show the window.
309 #if defined(USE_AURA) 314 #if defined(USE_AURA)
310 // TODO(beng): 315 GetWidget()->Show();
311 NOTIMPLEMENTED();
312 #elif defined(OS_WIN) 316 #elif defined(OS_WIN)
313 border_->ShowWindow(SW_SHOW); 317 border_->ShowWindow(SW_SHOW);
314 ShowWindow(SW_SHOW); 318 ShowWindow(SW_SHOW);
315 #elif defined(TOOLKIT_USES_GTK) 319 #elif defined(TOOLKIT_USES_GTK)
316 GetWidget()->Show(); 320 GetWidget()->Show();
317 #endif 321 #endif
318 322
319 if (fade_in) 323 if (fade_in)
320 FadeIn(); 324 FadeIn();
321 } 325 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 animation_->Hide(); 450 animation_->Hide();
447 } 451 }
448 452
449 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { 453 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) {
450 if (!delegate_ || delegate_->CloseOnEscape()) { 454 if (!delegate_ || delegate_->CloseOnEscape()) {
451 DoClose(true); 455 DoClose(true);
452 return true; 456 return true;
453 } 457 }
454 return false; 458 return false;
455 } 459 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698