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

Side by Side Diff: chrome/browser/chromeos/options/network_config_view.cc

Issue 16374006: Place browser-modal dialogs like web-contents-modal dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes and cleanup. 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
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/chromeos/options/network_config_view.h" 5 #include "chrome/browser/chromeos/options/network_config_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/chromeos/cros/network_property_ui_data.h" 12 #include "chrome/browser/chromeos/cros/network_property_ui_data.h"
13 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 13 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
14 #include "chrome/browser/chromeos/options/vpn_config_view.h" 14 #include "chrome/browser/chromeos/options/vpn_config_view.h"
15 #include "chrome/browser/chromeos/options/wifi_config_view.h" 15 #include "chrome/browser/chromeos/options/wifi_config_view.h"
16 #include "chrome/browser/chromeos/options/wimax_config_view.h" 16 #include "chrome/browser/chromeos/options/wimax_config_view.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/host_desktop.h" 21 #include "chrome/browser/ui/host_desktop.h"
22 #include "chrome/browser/ui/views/constrained_window_views.h"
22 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/locale_settings.h" 25 #include "grit/locale_settings.h"
25 #include "grit/theme_resources.h" 26 #include "grit/theme_resources.h"
26 #include "ui/aura/root_window.h" 27 #include "ui/aura/root_window.h"
27 #include "ui/base/accessibility/accessible_view_state.h" 28 #include "ui/base/accessibility/accessible_view_state.h"
28 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/gfx/image/image.h" 31 #include "ui/gfx/image/image.h"
31 #include "ui/gfx/rect.h" 32 #include "ui/gfx/rect.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (details.is_add && details.child == this) { 246 if (details.is_add && details.child == this) {
246 AddChildView(child_config_view_); 247 AddChildView(child_config_view_);
247 } 248 }
248 } 249 }
249 250
250 void NetworkConfigView::ShowDialog(gfx::NativeWindow parent) { 251 void NetworkConfigView::ShowDialog(gfx::NativeWindow parent) {
251 if (parent == NULL) 252 if (parent == NULL)
252 parent = GetDialogParent(); 253 parent = GetDialogParent();
253 // Failed connections may result in a pop-up with no natural parent window, 254 // Failed connections may result in a pop-up with no natural parent window,
254 // so provide a fallback context on the active display. 255 // so provide a fallback context on the active display.
255 gfx::NativeWindow context = parent ? NULL : ash::Shell::GetActiveRootWindow(); 256 Widget* window = NULL;
256 Widget* window = DialogDelegate::CreateDialogWidget(this, context, parent); 257 if (parent == NULL) {
258 window = DialogDelegate::CreateDialogWidget(
259 this, ash::Shell::GetActiveRootWindow(), parent);
260 } else {
261 window = CreateBrowserModalDialogViews(this, parent);
262 }
257 window->SetAlwaysOnTop(true); 263 window->SetAlwaysOnTop(true);
258 window->Show(); 264 window->Show();
259 } 265 }
260 266
261 ControlledSettingIndicatorView::ControlledSettingIndicatorView() 267 ControlledSettingIndicatorView::ControlledSettingIndicatorView()
262 : managed_(false), 268 : managed_(false),
263 image_view_(NULL) { 269 image_view_(NULL) {
264 Init(); 270 Init();
265 } 271 }
266 272
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 image_view_ = new views::ImageView(); 316 image_view_ = new views::ImageView();
311 // Disable |image_view_| so mouse events propagate to the parent. 317 // Disable |image_view_| so mouse events propagate to the parent.
312 image_view_->SetEnabled(false); 318 image_view_->SetEnabled(false);
313 image_view_->SetImage(gray_image_); 319 image_view_->SetImage(gray_image_);
314 image_view_->SetTooltipText( 320 image_view_->SetTooltipText(
315 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); 321 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY));
316 AddChildView(image_view_); 322 AddChildView(image_view_);
317 } 323 }
318 324
319 } // namespace chromeos 325 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698