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

Side by Side Diff: chrome/browser/ui/views/notifications/balloon_view.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/ui/views/notifications/balloon_view.h" 5 #include "chrome/browser/ui/views/notifications/balloon_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // but the child windows don't render). 309 // but the child windows don't render).
310 // 310 //
311 // We carefully keep these two windows in sync to present the illusion of 311 // We carefully keep these two windows in sync to present the illusion of
312 // one window to the user. 312 // one window to the user.
313 // 313 //
314 // We don't let the OS manage the RTL layout of these widgets, because 314 // We don't let the OS manage the RTL layout of these widgets, because
315 // this code is already taking care of correctly reversing the layout. 315 // this code is already taking care of correctly reversing the layout.
316 gfx::Rect contents_rect = GetContentsRectangle(); 316 gfx::Rect contents_rect = GetContentsRectangle();
317 html_contents_.reset(new BalloonViewHost(balloon)); 317 html_contents_.reset(new BalloonViewHost(balloon));
318 html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); 318 html_contents_->SetPreferredSize(gfx::Size(10000, 10000));
319 html_container_ = Widget::CreateWidget();
320 html_container_->SetAlwaysOnTop(true);
319 Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); 321 Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP);
320 params.mirror_origin_in_rtl = false; 322 params.bounds = contents_rect;
321 html_container_ = Widget::CreateWidget(params); 323 html_container_->Init(params);
322 html_container_->SetAlwaysOnTop(true);
323 html_container_->Init(NULL, contents_rect);
324 html_container_->SetContentsView(html_contents_->view()); 324 html_container_->SetContentsView(html_contents_->view());
325 325
326 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); 326 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight());
327 params.transparent = true; 327 frame_container_ = Widget::CreateWidget();
328 frame_container_ = Widget::CreateWidget(params);
329 frame_container_->set_widget_delegate(this); 328 frame_container_->set_widget_delegate(this);
330 frame_container_->SetAlwaysOnTop(true); 329 frame_container_->SetAlwaysOnTop(true);
331 frame_container_->Init(NULL, balloon_rect); 330 params.transparent = true;
331 params.bounds = balloon_rect;
332 frame_container_->Init(params);
332 frame_container_->SetContentsView(this); 333 frame_container_->SetContentsView(this);
333 frame_container_->MoveAboveWidget(html_container_); 334 frame_container_->MoveAboveWidget(html_container_);
334 335
335 close_button_->SetImage(views::CustomButton::BS_NORMAL, 336 close_button_->SetImage(views::CustomButton::BS_NORMAL,
336 rb.GetBitmapNamed(IDR_TAB_CLOSE)); 337 rb.GetBitmapNamed(IDR_TAB_CLOSE));
337 close_button_->SetImage(views::CustomButton::BS_HOT, 338 close_button_->SetImage(views::CustomButton::BS_HOT,
338 rb.GetBitmapNamed(IDR_TAB_CLOSE_H)); 339 rb.GetBitmapNamed(IDR_TAB_CLOSE_H));
339 close_button_->SetImage(views::CustomButton::BS_PUSHED, 340 close_button_->SetImage(views::CustomButton::BS_PUSHED,
340 rb.GetBitmapNamed(IDR_TAB_CLOSE_P)); 341 rb.GetBitmapNamed(IDR_TAB_CLOSE_P));
341 close_button_->SetBoundsRect(GetCloseButtonBounds()); 342 close_button_->SetBoundsRect(GetCloseButtonBounds());
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 NOTREACHED(); 498 NOTREACHED();
498 return; 499 return;
499 } 500 }
500 501
501 // If the renderer process attached to this balloon is disconnected 502 // If the renderer process attached to this balloon is disconnected
502 // (e.g., because of a crash), we want to close the balloon. 503 // (e.g., because of a crash), we want to close the balloon.
503 notification_registrar_.Remove(this, 504 notification_registrar_.Remove(this,
504 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); 505 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_));
505 Close(false); 506 Close(false);
506 } 507 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/native_constrained_window_win.cc ('k') | chrome/browser/ui/views/status_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698