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

Side by Side Diff: chrome/browser/chromeos/login/helper.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/chromeos/login/helper.h" 5 #include "chrome/browser/chromeos/login/helper.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/chromeos/cros/network_library.h" 8 #include "chrome/browser/chromeos/cros/network_library.h"
9 #include "chrome/browser/chromeos/customization_document.h" 9 #include "chrome/browser/chromeos/customization_document.h"
10 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 host_gtk_window = gtk_widget_get_parent(host_gtk_window); 101 host_gtk_window = gtk_widget_get_parent(host_gtk_window);
102 if (!host_gtk_window) { 102 if (!host_gtk_window) {
103 LOG(WARNING) << "Failed to start the throbber: no GtkWindow"; 103 LOG(WARNING) << "Failed to start the throbber: no GtkWindow";
104 return; 104 return;
105 } 105 }
106 106
107 views::SmoothedThrobber* throbber = CreateDefaultSmoothedThrobber(); 107 views::SmoothedThrobber* throbber = CreateDefaultSmoothedThrobber();
108 throbber->set_stop_delay_ms(0); 108 throbber->set_stop_delay_ms(0);
109 gfx::Rect throbber_bounds = CalculateThrobberBounds(throbber); 109 gfx::Rect throbber_bounds = CalculateThrobberBounds(throbber);
110 110
111 throbber_widget_ = views::Widget::CreateWidget();
112 static_cast<views::WidgetGtk*>(throbber_widget_->native_widget())->
113 make_transient_to_parent();
114
115 throbber_bounds.Offset(host_view_->GetScreenBounds().origin());
111 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_WINDOW); 116 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_WINDOW);
112 params.transparent = true; 117 params.transparent = true;
113 throbber_widget_ = views::Widget::CreateWidget(params); 118 params.bounds = throbber_bounds;
114 static_cast<views::WidgetGtk*>(throbber_widget_)->make_transient_to_parent(); 119 params.parent = host_gtk_window;
115 120 throbber_widget_->Init(params);
116 throbber_bounds.Offset(host_view_->GetScreenBounds().origin());
117 throbber_widget_->Init(host_gtk_window, throbber_bounds);
118 throbber_widget_->SetContentsView(throbber); 121 throbber_widget_->SetContentsView(throbber);
119 // This keeps the window from flashing at startup. 122 // This keeps the window from flashing at startup.
120 gdk_window_set_back_pixmap( 123 gdk_window_set_back_pixmap(
121 throbber_widget_->GetNativeView()->window, NULL, false); 124 throbber_widget_->GetNativeView()->window, NULL, false);
122 throbber_widget_->Show(); 125 throbber_widget_->Show();
123 // WM can ignore bounds before widget is shown. 126 // WM can ignore bounds before widget is shown.
124 throbber_widget_->SetBounds(throbber_bounds); 127 throbber_widget_->SetBounds(throbber_bounds);
125 throbber->Start(); 128 throbber->Start();
126 } 129 }
127 130
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 gfx::Size preferred_size = NativeButton::GetPreferredSize(); 251 gfx::Size preferred_size = NativeButton::GetPreferredSize();
249 // Set minimal width. 252 // Set minimal width.
250 if (preferred_size.width() < kButtonMinWidth) 253 if (preferred_size.width() < kButtonMinWidth)
251 preferred_size.set_width(kButtonMinWidth); 254 preferred_size.set_width(kButtonMinWidth);
252 return preferred_size; 255 return preferred_size;
253 } 256 }
254 257
255 } // namespace login 258 } // namespace login
256 259
257 } // namespace chromeos 260 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698