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

Side by Side Diff: chrome/browser/chromeos/status/network_menu_button.cc

Issue 8513007: [cros] Use LoginDisplayHost::GetNativeWindow() for status area on login screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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 | « chrome/browser/chromeos/login/network_screen.h ('k') | chrome/chrome_browser.gypi » ('j') | 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) 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/status/network_menu_button.h" 5 #include "chrome/browser/chromeos/status/network_menu_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/cros/cros_library.h" 18 #include "chrome/browser/chromeos/cros/cros_library.h"
19 #include "chrome/browser/chromeos/login/base_login_display_host.h"
19 #include "chrome/browser/chromeos/login/helper.h" 20 #include "chrome/browser/chromeos/login/helper.h"
20 #include "chrome/browser/chromeos/login/user_manager.h" 21 #include "chrome/browser/chromeos/login/user_manager.h"
21 #include "chrome/browser/chromeos/options/network_config_view.h" 22 #include "chrome/browser/chromeos/options/network_config_view.h"
22 #include "chrome/browser/chromeos/sim_dialog_delegate.h" 23 #include "chrome/browser/chromeos/sim_dialog_delegate.h"
23 #include "chrome/browser/chromeos/view_ids.h" 24 #include "chrome/browser/chromeos/view_ids.h"
24 #include "chrome/browser/prefs/pref_service.h" 25 #include "chrome/browser/prefs/pref_service.h"
25 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_list.h" 28 #include "chrome/browser/ui/browser_list.h"
28 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 191 }
191 192
192 //////////////////////////////////////////////////////////////////////////////// 193 ////////////////////////////////////////////////////////////////////////////////
193 // NetworkMenuButton, NetworkMenu implementation: 194 // NetworkMenuButton, NetworkMenu implementation:
194 195
195 views::MenuButton* NetworkMenuButton::GetMenuButton() { 196 views::MenuButton* NetworkMenuButton::GetMenuButton() {
196 return this; 197 return this;
197 } 198 }
198 199
199 gfx::NativeWindow NetworkMenuButton::GetNativeWindow() const { 200 gfx::NativeWindow NetworkMenuButton::GetNativeWindow() const {
200 // This must always have a parent, which must have a widget ancestor. 201 if (BaseLoginDisplayHost::default_host()) {
201 return parent()->GetWidget()->GetNativeWindow(); 202 // When not in browser mode i.e. login screen, status area is hosted in
203 // a separate widget.
204 return BaseLoginDisplayHost::default_host()->GetNativeWindow();
205 } else {
206 // This must always have a parent, which must have a widget ancestor.
207 return parent()->GetWidget()->GetNativeWindow();
208 }
202 } 209 }
203 210
204 void NetworkMenuButton::OpenButtonOptions() { 211 void NetworkMenuButton::OpenButtonOptions() {
205 delegate()->ExecuteStatusAreaCommand( 212 delegate()->ExecuteStatusAreaCommand(
206 this, StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS); 213 this, StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS);
207 } 214 }
208 215
209 bool NetworkMenuButton::ShouldOpenButtonOptions() const { 216 bool NetworkMenuButton::ShouldOpenButtonOptions() const {
210 return delegate()->ShouldExecuteStatusAreaCommand( 217 return delegate()->ShouldExecuteStatusAreaCommand(
211 this, StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS); 218 this, StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1); 449 SetCarrierDealPromoShown(carrier_deal_promo_pref + 1);
443 } 450 }
444 } 451 }
445 452
446 void NetworkMenuButton::SetTooltipAndAccessibleName(const string16& label) { 453 void NetworkMenuButton::SetTooltipAndAccessibleName(const string16& label) {
447 SetTooltipText(label); 454 SetTooltipText(label);
448 SetAccessibleName(label); 455 SetAccessibleName(label);
449 } 456 }
450 457
451 } // namespace chromeos 458 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/network_screen.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698