| OLD | NEW | 
|    1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2010 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/network_selection_view.h" |    5 #include "chrome/browser/chromeos/login/network_selection_view.h" | 
|    6  |    6  | 
|    7 #include <signal.h> |    7 #include <signal.h> | 
|    8 #include <sys/types.h> |    8 #include <sys/types.h> | 
|    9 #include <string> |    9 #include <string> | 
|   10  |   10  | 
|   11 #include "app/l10n_util.h" |   11 #include "app/l10n_util.h" | 
|   12 #include "app/resource_bundle.h" |   12 #include "app/resource_bundle.h" | 
|   13 #include "base/utf_string_conversions.h" |   13 #include "base/utf_string_conversions.h" | 
|   14 #include "chrome/browser/chromeos/login/helper.h" |   14 #include "chrome/browser/chromeos/login/helper.h" | 
|   15 #include "chrome/browser/chromeos/login/keyboard_switch_menu.h" |   15 #include "chrome/browser/chromeos/login/keyboard_switch_menu.h" | 
|   16 #include "chrome/browser/chromeos/login/language_switch_menu.h" |   16 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 
|   17 #include "chrome/browser/chromeos/login/network_screen_delegate.h" |   17 #include "chrome/browser/chromeos/login/network_screen_delegate.h" | 
|   18 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" |   18 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" | 
|   19 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |   19 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 
|   20 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |   20 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 
|   21 #include "chrome/browser/chromeos/status/network_dropdown_button.h" |   21 #include "chrome/browser/chromeos/status/network_dropdown_button.h" | 
|   22 #include "gfx/size.h" |   22 #include "gfx/size.h" | 
|   23 #include "grit/chromium_strings.h" |   23 #include "grit/chromium_strings.h" | 
|   24 #include "grit/generated_resources.h" |   24 #include "grit/generated_resources.h" | 
|   25 #include "grit/theme_resources.h" |   25 #include "grit/theme_resources.h" | 
|   26 #include "views/controls/button/native_button.h" |  | 
|   27 #include "views/controls/label.h" |   26 #include "views/controls/label.h" | 
|   28 #include "views/controls/throbber.h" |   27 #include "views/controls/throbber.h" | 
|   29 #include "views/fill_layout.h" |   28 #include "views/fill_layout.h" | 
|   30 #include "views/grid_layout.h" |   29 #include "views/grid_layout.h" | 
|   31 #include "views/standard_layout.h" |   30 #include "views/standard_layout.h" | 
|   32 #include "views/widget/widget.h" |   31 #include "views/widget/widget.h" | 
|   33 #include "views/widget/widget_gtk.h" |   32 #include "views/widget/widget_gtk.h" | 
|   34 #include "views/window/non_client_view.h" |   33 #include "views/window/non_client_view.h" | 
|   35 #include "views/window/window.h" |   34 #include "views/window/window.h" | 
|   36 #include "views/window/window_gtk.h" |   35 #include "views/window/window_gtk.h" | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   54   CONTENTS_ROW, |   53   CONTENTS_ROW, | 
|   55 }; |   54 }; | 
|   56  |   55  | 
|   57 // Grid layout constants. |   56 // Grid layout constants. | 
|   58 const int kBorderSize = 10; |   57 const int kBorderSize = 10; | 
|   59 const int kWelcomeTitlePadding = 10; |   58 const int kWelcomeTitlePadding = 10; | 
|   60 const int kPaddingColumnWidth = 55; |   59 const int kPaddingColumnWidth = 55; | 
|   61 const int kMediumPaddingColumnWidth = 20; |   60 const int kMediumPaddingColumnWidth = 20; | 
|   62 const int kControlPaddingRow = 15; |   61 const int kControlPaddingRow = 15; | 
|   63  |   62  | 
|   64 // Size to add to the welcome title font. |  | 
|   65 const int kWelcomeTitleFontDelta = 5; |  | 
|   66  |  | 
|   67 // Fixed size for language/keyboard/network controls height. |   63 // Fixed size for language/keyboard/network controls height. | 
|   68 const int kSelectionBoxHeight = 29; |   64 const int kSelectionBoxHeight = 29; | 
|   69  |   65  | 
|   70 // Menu button is drawn using our custom icons in resources. See |   66 // Menu button is drawn using our custom icons in resources. See | 
|   71 // TextButtonBorder::Paint() for details. So this offset compensate |   67 // TextButtonBorder::Paint() for details. So this offset compensate | 
|   72 // horizontal size, eaten by those icons. |   68 // horizontal size, eaten by those icons. | 
|   73 const int kMenuHorizontalOffset = -3; |   69 const int kMenuHorizontalOffset = -3; | 
|   74  |   70  | 
|   75 // Vertical addition to the menu window to make it appear exactly below |   71 // Vertical addition to the menu window to make it appear exactly below | 
|   76 // MenuButton. |   72 // MenuButton. | 
|   77 const int kMenuVerticalOffset = -1; |   73 const int kMenuVerticalOffset = -1; | 
|   78  |   74  | 
|   79 // Offset that compensates menu width so that it matches |   75 // Offset that compensates menu width so that it matches | 
|   80 // menu button visual width when being in pushed state. |   76 // menu button visual width when being in pushed state. | 
|   81 const int kMenuWidthOffset = 6; |   77 const int kMenuWidthOffset = 6; | 
|   82  |   78  | 
|   83 const SkColor kWelcomeColor = 0xFFCDD3D6; |   79 const SkColor kWelcomeColor = 0xFFCDD3D6; | 
|   84  |   80  | 
|   85 // Initializes menu button default properties. |   81 // Initializes menu button default properties. | 
|   86 static void InitMenuButtonProperties(views::MenuButton* menu_button) { |   82 static void InitMenuButtonProperties(views::MenuButton* menu_button) { | 
|   87   menu_button->SetFocusable(true); |   83   menu_button->SetFocusable(true); | 
|   88   menu_button->SetNormalHasBorder(true); |   84   menu_button->SetNormalHasBorder(true); | 
|   89   menu_button->SetEnabledColor(SK_ColorBLACK); |   85   menu_button->SetEnabledColor(SK_ColorBLACK); | 
|   90   menu_button->SetHighlightColor(SK_ColorBLACK); |   86   menu_button->SetHighlightColor(SK_ColorBLACK); | 
|   91   menu_button->SetHoverColor(SK_ColorBLACK); |   87   menu_button->SetHoverColor(SK_ColorBLACK); | 
|   92   menu_button->set_animate_on_state_change(false); |   88   menu_button->set_animate_on_state_change(false); | 
|   93   // Menu is positioned by bottom right corner of the MenuButton. |   89   // Menu is positioned by bottom right corner of the MenuButton. | 
|   94   menu_button->set_menu_offset(kMenuHorizontalOffset, kMenuVerticalOffset); |   90   menu_button->set_menu_offset(kMenuHorizontalOffset, kMenuVerticalOffset); | 
 |   91   chromeos::CorrectMenuButtonFontSize(menu_button); | 
|   95 } |   92 } | 
|   96  |   93  | 
|   97 }  // namespace |   94 }  // namespace | 
|   98  |   95  | 
|   99 namespace chromeos { |   96 namespace chromeos { | 
|  100  |   97  | 
|  101 // NetworkDropdownButton with custom Activate() behavior. |   98 // NetworkDropdownButton with custom Activate() behavior. | 
|  102 class NetworkControlReportOnActivate : public NetworkDropdownButton { |   99 class NetworkControlReportOnActivate : public NetworkDropdownButton { | 
|  103  public: |  100  public: | 
|  104   NetworkControlReportOnActivate(bool browser_mode, |  101   NetworkControlReportOnActivate(bool browser_mode, | 
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  441 } |  438 } | 
|  442  |  439  | 
|  443 //////////////////////////////////////////////////////////////////////////////// |  440 //////////////////////////////////////////////////////////////////////////////// | 
|  444 // NetworkSelectionView, private: |  441 // NetworkSelectionView, private: | 
|  445  |  442  | 
|  446 void NetworkSelectionView::RecreateNativeControls() { |  443 void NetworkSelectionView::RecreateNativeControls() { | 
|  447   // There is no way to get native button preferred size after the button was |  444   // There is no way to get native button preferred size after the button was | 
|  448   // sized so delete and recreate the button on text update. |  445   // sized so delete and recreate the button on text update. | 
|  449   bool is_continue_enabled = IsContinueEnabled(); |  446   bool is_continue_enabled = IsContinueEnabled(); | 
|  450   delete continue_button_; |  447   delete continue_button_; | 
|  451   continue_button_ = new views::NativeButton( |  448   continue_button_ = new login::WideButton( | 
|  452       delegate_, |  449       delegate_, | 
|  453       l10n_util::GetString(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)); |  450       l10n_util::GetString(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)); | 
|  454   continue_button_->SetEnabled(is_continue_enabled); |  451   continue_button_->SetEnabled(is_continue_enabled); | 
|  455 } |  452 } | 
|  456  |  453  | 
|  457 void NetworkSelectionView::UpdateConnectingNetworkLabel() { |  454 void NetworkSelectionView::UpdateConnectingNetworkLabel() { | 
|  458   connecting_network_label_->SetText(l10n_util::GetStringF( |  455   connecting_network_label_->SetText(l10n_util::GetStringF( | 
|  459       IDS_NETWORK_SELECTION_CONNECTING, UTF16ToWide(network_id_))); |  456       IDS_NETWORK_SELECTION_CONNECTING, UTF16ToWide(network_id_))); | 
|  460 } |  457 } | 
|  461  |  458  | 
|  462 }  // namespace chromeos |  459 }  // namespace chromeos | 
| OLD | NEW |