diff options
author | nkostylev@google.com <nkostylev@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 06:42:38 +0000 |
---|---|---|
committer | nkostylev@google.com <nkostylev@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 06:42:38 +0000 |
commit | c04ec03c76f5d6f86605103d98f1608b59c8cc7f (patch) | |
tree | 84313233f04fd533f80d94886c2c6a550e055cdb /chrome/browser/chromeos/options | |
parent | 1229f0b556f09ee6997684d5e6f799cf15228bb4 (diff) | |
download | chromium_src-c04ec03c76f5d6f86605103d98f1608b59c8cc7f.zip chromium_src-c04ec03c76f5d6f86605103d98f1608b59c8cc7f.tar.gz chromium_src-c04ec03c76f5d6f86605103d98f1608b59c8cc7f.tar.bz2 |
Fix crash when opening "Select certificate file" in OOBE.
Pass default profile and correct top window in OOBE.
BUG=http://crosbug.com/2978
TEST=On welcome screen select encrypted 802.1X network and open "select certificate" dialog. It should open withot crash.
Review URL: http://codereview.chromium.org/2053001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/options')
-rw-r--r-- | chrome/browser/chromeos/options/network_config_view.cc | 19 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/network_config_view.h | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/wifi_config_view.cc | 7 |
3 files changed, 35 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc index b48a60a..f5aa05e 100644 --- a/chrome/browser/chromeos/options/network_config_view.cc +++ b/chrome/browser/chromeos/options/network_config_view.cc @@ -13,19 +13,24 @@ #include "grit/locale_settings.h" #include "views/grid_layout.h" #include "views/standard_layout.h" +#include "views/widget/widget_gtk.h" #include "views/window/window.h" +using views::WidgetGtk; + namespace chromeos { NetworkConfigView::NetworkConfigView(EthernetNetwork ethernet) - : flags_(FLAG_ETHERNET | FLAG_SHOW_IPCONFIG), + : browser_mode_(true), + flags_(FLAG_ETHERNET | FLAG_SHOW_IPCONFIG), ethernet_(ethernet), wificonfig_view_(NULL), ipconfig_view_(NULL) { } NetworkConfigView::NetworkConfigView(WifiNetwork wifi, bool login_only) - : flags_(FLAG_WIFI), + : browser_mode_(true), + flags_(FLAG_WIFI), wifi_(wifi), wificonfig_view_(NULL), ipconfig_view_(NULL) { @@ -36,18 +41,24 @@ NetworkConfigView::NetworkConfigView(WifiNetwork wifi, bool login_only) } NetworkConfigView::NetworkConfigView(CellularNetwork cellular) - : flags_(FLAG_CELLULAR | FLAG_SHOW_IPCONFIG), + : browser_mode_(true), + flags_(FLAG_CELLULAR | FLAG_SHOW_IPCONFIG), cellular_(cellular), wificonfig_view_(NULL), ipconfig_view_(NULL) { } NetworkConfigView::NetworkConfigView() - : flags_(FLAG_WIFI | FLAG_LOGIN_ONLY | FLAG_OTHER_NETWORK), + : browser_mode_(true), + flags_(FLAG_WIFI | FLAG_LOGIN_ONLY | FLAG_OTHER_NETWORK), wificonfig_view_(NULL), ipconfig_view_(NULL) { } +gfx::NativeWindow NetworkConfigView::GetNativeWindow() const { + return GTK_WINDOW(static_cast<WidgetGtk*>(GetWidget())->GetNativeView()); +} + std::wstring NetworkConfigView::GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (button == MessageBoxFlags::DIALOGBUTTON_OK) { diff --git a/chrome/browser/chromeos/options/network_config_view.h b/chrome/browser/chromeos/options/network_config_view.h index 65704bd..3b42abd 100644 --- a/chrome/browser/chromeos/options/network_config_view.h +++ b/chrome/browser/chromeos/options/network_config_view.h @@ -38,6 +38,9 @@ class NetworkConfigView : public views::View, explicit NetworkConfigView(); virtual ~NetworkConfigView() {} + // Returns corresponding native window. + gfx::NativeWindow GetNativeWindow() const; + // views::DialogDelegate methods. virtual std::wstring GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const; @@ -59,6 +62,14 @@ class NetworkConfigView : public views::View, // Sets the focus on the login tab's first textfield. void SetLoginTextfieldFocus(); + // Getter/setter for browser mode. + void set_browser_mode(bool value) { + browser_mode_ = value; + } + bool is_browser_mode() const { + return browser_mode_; + } + protected: // views::View overrides: virtual void Layout(); @@ -80,6 +91,9 @@ class NetworkConfigView : public views::View, // Initializes UI. void Init(); + // True when opening in browser, otherwise in OOBE/login mode. + bool browser_mode_; + views::TabbedPane* tabs_; // NetworkConfigFlags to specify which UIs to show. diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index e360973..2ca3fc3 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc @@ -87,9 +87,14 @@ void WifiConfigView::ButtonPressed(views::Button* sender, passphrase_textfield_->SetPassword(!passphrase_textfield_->IsPassword()); } else if (sender == certificate_browse_button_) { select_file_dialog_ = SelectFileDialog::Create(this); + select_file_dialog_->set_browser_mode(parent_->is_browser_mode()); select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, string16(), FilePath(), NULL, 0, - std::string(), NULL, NULL); + std::string(), + parent_->is_browser_mode() ? + NULL : + parent_->GetNativeWindow(), + NULL); } else { NOTREACHED(); } |