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_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 18 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
19 #include "chrome/browser/ui/location_bar/location_bar.h" | 19 #include "chrome/browser/ui/location_bar/location_bar.h" |
20 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" | 20 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" |
21 #include "components/content_settings/core/common/content_settings_types.h" | 21 #include "components/content_settings/core/common/content_settings_types.h" |
22 #include "components/prefs/pref_member.h" | 22 #include "components/prefs/pref_member.h" |
| 23 #include "components/security_state/security_state_model.h" |
23 #include "components/zoom/zoom_event_manager_observer.h" | 24 #include "components/zoom/zoom_event_manager_observer.h" |
24 | 25 |
25 @class AutocompleteTextField; | 26 @class AutocompleteTextField; |
26 class CommandUpdater; | 27 class CommandUpdater; |
27 class ContentSettingDecoration; | 28 class ContentSettingDecoration; |
28 class EVBubbleDecoration; | 29 class SecureVerboseBubbleDecoration; |
29 class KeywordHintDecoration; | 30 class KeywordHintDecoration; |
30 class LocationBarDecoration; | 31 class LocationBarDecoration; |
31 class LocationIconDecoration; | 32 class LocationIconDecoration; |
32 class ManagePasswordsDecoration; | 33 class ManagePasswordsDecoration; |
33 class PageActionDecoration; | 34 class PageActionDecoration; |
34 class Profile; | 35 class Profile; |
35 class SaveCreditCardDecoration; | 36 class SaveCreditCardDecoration; |
36 class SelectedKeywordDecoration; | 37 class SelectedKeywordDecoration; |
37 class StarDecoration; | 38 class StarDecoration; |
38 class TranslateDecoration; | 39 class TranslateDecoration; |
39 class ZoomDecoration; | 40 class ZoomDecoration; |
40 class ZoomDecorationTest; | 41 class ZoomDecorationTest; |
41 | 42 |
| 43 namespace net { |
| 44 class X509Certificate; |
| 45 } |
| 46 |
42 // A C++ bridge class that represents the location bar UI element to | 47 // A C++ bridge class that represents the location bar UI element to |
43 // the portable code. Wires up an OmniboxViewMac instance to | 48 // the portable code. Wires up an OmniboxViewMac instance to |
44 // the location bar text field, which handles most of the work. | 49 // the location bar text field, which handles most of the work. |
45 | 50 |
46 class LocationBarViewMac : public LocationBar, | 51 class LocationBarViewMac : public LocationBar, |
47 public LocationBarTesting, | 52 public LocationBarTesting, |
48 public ChromeOmniboxEditController, | 53 public ChromeOmniboxEditController, |
49 public zoom::ZoomEventManagerObserver { | 54 public zoom::ZoomEventManagerObserver { |
50 public: | 55 public: |
51 LocationBarViewMac(AutocompleteTextField* field, | 56 LocationBarViewMac(AutocompleteTextField* field, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 182 |
178 // ChromeOmniboxEditController: | 183 // ChromeOmniboxEditController: |
179 void UpdateWithoutTabRestore() override; | 184 void UpdateWithoutTabRestore() override; |
180 void OnChanged() override; | 185 void OnChanged() override; |
181 void ShowURL() override; | 186 void ShowURL() override; |
182 ToolbarModel* GetToolbarModel() override; | 187 ToolbarModel* GetToolbarModel() override; |
183 const ToolbarModel* GetToolbarModel() const override; | 188 const ToolbarModel* GetToolbarModel() const override; |
184 content::WebContents* GetWebContents() override; | 189 content::WebContents* GetWebContents() override; |
185 | 190 |
186 bool ShouldShowEVBubble() const; | 191 bool ShouldShowEVBubble() const; |
| 192 |
| 193 // Returns true if the secure verbose decoration should be displayed. This |
| 194 // includes the EV cert decoration. For Phase 1, the verbose shouldn't be |
| 195 // displayed for "Not Secure". |
| 196 bool ShouldShowSecureVerbose() const; |
| 197 |
187 NSImage* GetKeywordImage(const base::string16& keyword); | 198 NSImage* GetKeywordImage(const base::string16& keyword); |
188 | 199 |
| 200 // Returns the color for the vector icon in the location bar. |
| 201 SkColor GetLocationBarIconColor() const; |
| 202 |
189 AutocompleteTextField* GetAutocompleteTextField() { return field_; } | 203 AutocompleteTextField* GetAutocompleteTextField() { return field_; } |
190 | 204 |
191 // Returns true if the location bar is dark. | 205 // Returns true if the location bar is dark. |
192 bool IsLocationBarDark() const; | 206 bool IsLocationBarDark() const; |
193 | 207 |
194 ManagePasswordsDecoration* manage_passwords_decoration() { | 208 ManagePasswordsDecoration* manage_passwords_decoration() { |
195 return manage_passwords_decoration_.get(); | 209 return manage_passwords_decoration_.get(); |
196 } | 210 } |
197 | 211 |
198 Browser* browser() const { return browser_; } | 212 Browser* browser() const { return browser_; } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 std::unique_ptr<OmniboxViewMac> omnibox_view_; | 255 std::unique_ptr<OmniboxViewMac> omnibox_view_; |
242 | 256 |
243 AutocompleteTextField* field_; // owned by tab controller | 257 AutocompleteTextField* field_; // owned by tab controller |
244 | 258 |
245 // A decoration that shows an icon to the left of the address. | 259 // A decoration that shows an icon to the left of the address. |
246 std::unique_ptr<LocationIconDecoration> location_icon_decoration_; | 260 std::unique_ptr<LocationIconDecoration> location_icon_decoration_; |
247 | 261 |
248 // A decoration that shows the keyword-search bubble on the left. | 262 // A decoration that shows the keyword-search bubble on the left. |
249 std::unique_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; | 263 std::unique_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; |
250 | 264 |
251 // A decoration that shows a lock icon and ev-cert label in a bubble | 265 // A decoration that shows a security icon and the secure verbose or ev-cert |
252 // on the left. | 266 // label in a bubble on the left. |
253 std::unique_ptr<EVBubbleDecoration> ev_bubble_decoration_; | 267 std::unique_ptr<SecureVerboseBubbleDecoration> |
| 268 secure_verbose_bubble_decoration_; |
254 | 269 |
255 // Save credit card icon on the right side of the omnibox. | 270 // Save credit card icon on the right side of the omnibox. |
256 std::unique_ptr<SaveCreditCardDecoration> save_credit_card_decoration_; | 271 std::unique_ptr<SaveCreditCardDecoration> save_credit_card_decoration_; |
257 | 272 |
258 // Bookmark star right of page actions. | 273 // Bookmark star right of page actions. |
259 std::unique_ptr<StarDecoration> star_decoration_; | 274 std::unique_ptr<StarDecoration> star_decoration_; |
260 | 275 |
261 // Translate icon at the end of the ominibox. | 276 // Translate icon at the end of the ominibox. |
262 std::unique_ptr<TranslateDecoration> translate_decoration_; | 277 std::unique_ptr<TranslateDecoration> translate_decoration_; |
263 | 278 |
(...skipping 14 matching lines...) Expand all Loading... |
278 std::unique_ptr<ManagePasswordsDecoration> manage_passwords_decoration_; | 293 std::unique_ptr<ManagePasswordsDecoration> manage_passwords_decoration_; |
279 | 294 |
280 Browser* browser_; | 295 Browser* browser_; |
281 | 296 |
282 // Used to change the visibility of the star decoration. | 297 // Used to change the visibility of the star decoration. |
283 BooleanPrefMember edit_bookmarks_enabled_; | 298 BooleanPrefMember edit_bookmarks_enabled_; |
284 | 299 |
285 // Indicates whether or not the location bar is currently visible. | 300 // Indicates whether or not the location bar is currently visible. |
286 bool location_bar_visible_; | 301 bool location_bar_visible_; |
287 | 302 |
| 303 // The security level of the location bar icon. |
| 304 security_state::SecurityStateModel::SecurityLevel security_level_; |
| 305 |
| 306 // The EV certificate for the "Extended Validation SSL" bubble. It's empty |
| 307 // if we are not displaying a certificate. |
| 308 scoped_refptr<net::X509Certificate> certificate_; |
| 309 |
288 // Used to schedule a task for the first run info bubble. | 310 // Used to schedule a task for the first run info bubble. |
289 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 311 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
290 | 312 |
291 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 313 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
292 }; | 314 }; |
293 | 315 |
294 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 316 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |