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

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

Issue 16172006: Center wide new-style Views JavaScript dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a parent_window NULL check. Created 7 years, 6 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 | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/javascript_app_modal_dialog_views.h" 5 #include "chrome/browser/ui/views/javascript_app_modal_dialog_views.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" 9 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 165
166 //////////////////////////////////////////////////////////////////////////////// 166 ////////////////////////////////////////////////////////////////////////////////
167 // NativeAppModalDialog, public: 167 // NativeAppModalDialog, public:
168 168
169 // static 169 // static
170 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( 170 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt(
171 JavaScriptAppModalDialog* dialog, 171 JavaScriptAppModalDialog* dialog,
172 gfx::NativeWindow parent_window) { 172 gfx::NativeWindow parent_window) {
173 JavaScriptAppModalDialogViews* d = new JavaScriptAppModalDialogViews(dialog); 173 JavaScriptAppModalDialogViews* d = new JavaScriptAppModalDialogViews(dialog);
174 views::DialogDelegate::CreateDialogWidget(d, NULL, parent_window); 174 views::Widget* widget =
175 views::DialogDelegate::CreateDialogWidget(d, NULL, parent_window);
176 views::Widget* parent_widget = parent_window ?
177 views::Widget::GetWidgetForNativeWindow(parent_window) : NULL;
178 // Horizontally center the dialog window within the parent window's bounds.
179 if (widget && parent_widget) {
180 gfx::Rect bounds(widget->GetWindowBoundsInScreen());
181 gfx::Rect parent_bounds(parent_widget->GetWindowBoundsInScreen());
182 bounds.set_x(parent_bounds.CenterPoint().x() - bounds.width() / 2);
183 widget->SetBounds(bounds);
184 }
175 return d; 185 return d;
176 } 186 }
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