OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/chromeos/cros/network_library.h" // ConnectionType | 14 #include "chrome/browser/chromeos/cros/network_library.h" // ConnectionType |
15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow | 15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow |
16 #include "ui/views/controls/button/menu_button_listener.h" | 16 #include "ui/views/controls/button/menu_button_listener.h" |
17 | 17 |
| 18 class Browser; |
| 19 |
18 namespace ui { | 20 namespace ui { |
19 class MenuModel; | 21 class MenuModel; |
20 } | 22 } |
21 | 23 |
22 namespace views { | 24 namespace views { |
23 class MenuItemView; | 25 class MenuItemView; |
24 class MenuButton; | 26 class MenuButton; |
25 class MenuModelAdapter; | 27 class MenuModelAdapter; |
26 class MenuRunner; | 28 class MenuRunner; |
27 } | 29 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 113 |
112 // Shows UI to user to search for cellular networks. | 114 // Shows UI to user to search for cellular networks. |
113 void ShowOtherCellular(); | 115 void ShowOtherCellular(); |
114 | 116 |
115 // Decides whether a network should be highlighted in the UI. | 117 // Decides whether a network should be highlighted in the UI. |
116 bool ShouldHighlightNetwork(const Network* network); | 118 bool ShouldHighlightNetwork(const Network* network); |
117 | 119 |
118 private: | 120 private: |
119 friend class NetworkMenuModel; | 121 friend class NetworkMenuModel; |
120 | 122 |
| 123 // Returns the last active browser. If there is no such browser, creates a new |
| 124 // browser window with an empty tab and returns it. |
| 125 Browser* GetAppropriateBrowser(); |
| 126 |
121 // Weak ptr to delegate. | 127 // Weak ptr to delegate. |
122 Delegate* delegate_; | 128 Delegate* delegate_; |
123 | 129 |
124 // Set to true if we are currently refreshing the menu. | 130 // Set to true if we are currently refreshing the menu. |
125 bool refreshing_menu_; | 131 bool refreshing_menu_; |
126 | 132 |
127 // The network menu. | 133 // The network menu. |
128 scoped_ptr<NetworkMenuModel> main_menu_model_; | 134 scoped_ptr<NetworkMenuModel> main_menu_model_; |
129 scoped_ptr<views::MenuModelAdapter> menu_model_adapter_; | 135 scoped_ptr<views::MenuModelAdapter> menu_model_adapter_; |
130 views::MenuItemView* menu_item_view_; | 136 views::MenuItemView* menu_item_view_; |
131 scoped_ptr<views::MenuRunner> menu_runner_; | 137 scoped_ptr<views::MenuRunner> menu_runner_; |
132 | 138 |
133 // Holds minimum width of the menu. | 139 // Holds minimum width of the menu. |
134 int min_width_; | 140 int min_width_; |
135 | 141 |
136 // Weak pointer factory so we can start connections at a later time | 142 // Weak pointer factory so we can start connections at a later time |
137 // without worrying that they will actually try to happen after the lifetime | 143 // without worrying that they will actually try to happen after the lifetime |
138 // of this object. | 144 // of this object. |
139 base::WeakPtrFactory<NetworkMenu> weak_pointer_factory_; | 145 base::WeakPtrFactory<NetworkMenu> weak_pointer_factory_; |
140 | 146 |
141 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); | 147 DISALLOW_COPY_AND_ASSIGN(NetworkMenu); |
142 }; | 148 }; |
143 | 149 |
144 } // namespace chromeos | 150 } // namespace chromeos |
145 | 151 |
146 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ | 152 #endif // CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_MENU_H_ |
OLD | NEW |