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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h

Issue 2119033002: [Material][Mac] Implement Omnibox Verbose State Chips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 3 months 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
OLDNEW
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 KeywordHintDecoration; 29 class KeywordHintDecoration;
30 class LocationBarDecoration; 30 class LocationBarDecoration;
31 class LocationIconDecoration; 31 class LocationIconDecoration;
32 class ManagePasswordsDecoration; 32 class ManagePasswordsDecoration;
33 class PageActionDecoration; 33 class PageActionDecoration;
34 class Profile; 34 class Profile;
35 class SaveCreditCardDecoration; 35 class SaveCreditCardDecoration;
36 class SelectedKeywordDecoration; 36 class SelectedKeywordDecoration;
37 class StarDecoration; 37 class StarDecoration;
38 class TranslateDecoration; 38 class TranslateDecoration;
39 class SecurityStateBubbleDecoration;
39 class ZoomDecoration; 40 class ZoomDecoration;
40 class ZoomDecorationTest; 41 class ZoomDecorationTest;
41 42
42 // A C++ bridge class that represents the location bar UI element to 43 // A C++ bridge class that represents the location bar UI element to
43 // the portable code. Wires up an OmniboxViewMac instance to 44 // the portable code. Wires up an OmniboxViewMac instance to
44 // the location bar text field, which handles most of the work. 45 // the location bar text field, which handles most of the work.
45 46
46 class LocationBarViewMac : public LocationBar, 47 class LocationBarViewMac : public LocationBar,
47 public LocationBarTesting, 48 public LocationBarTesting,
48 public ChromeOmniboxEditController, 49 public ChromeOmniboxEditController,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 178
178 // ChromeOmniboxEditController: 179 // ChromeOmniboxEditController:
179 void UpdateWithoutTabRestore() override; 180 void UpdateWithoutTabRestore() override;
180 void OnChanged() override; 181 void OnChanged() override;
181 void ShowURL() override; 182 void ShowURL() override;
182 ToolbarModel* GetToolbarModel() override; 183 ToolbarModel* GetToolbarModel() override;
183 const ToolbarModel* GetToolbarModel() const override; 184 const ToolbarModel* GetToolbarModel() const override;
184 content::WebContents* GetWebContents() override; 185 content::WebContents* GetWebContents() override;
185 186
186 bool ShouldShowEVBubble() const; 187 bool ShouldShowEVBubble() const;
188
189 // Returns true if the security state decoration should be displayed. The
190 // security state should only be shown for valid and invalid HTTPS states.
191 bool ShouldShowSecurityState() const;
192
187 NSImage* GetKeywordImage(const base::string16& keyword); 193 NSImage* GetKeywordImage(const base::string16& keyword);
188 194
195 // Returns the color for the vector icon in the location bar.
196 SkColor GetLocationBarIconColor() const;
197
189 AutocompleteTextField* GetAutocompleteTextField() { return field_; } 198 AutocompleteTextField* GetAutocompleteTextField() { return field_; }
190 199
191 // Returns true if the location bar is dark. 200 // Returns true if the location bar is dark.
192 bool IsLocationBarDark() const; 201 bool IsLocationBarDark() const;
193 202
194 ManagePasswordsDecoration* manage_passwords_decoration() { 203 ManagePasswordsDecoration* manage_passwords_decoration() {
195 return manage_passwords_decoration_.get(); 204 return manage_passwords_decoration_.get();
196 } 205 }
197 206
198 Browser* browser() const { return browser_; } 207 Browser* browser() const { return browser_; }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void ShowFirstRunBubbleInternal(); 245 void ShowFirstRunBubbleInternal();
237 246
238 // Updates the translate decoration in the omnibox with the current translate 247 // Updates the translate decoration in the omnibox with the current translate
239 // state. 248 // state.
240 void UpdateTranslateDecoration(); 249 void UpdateTranslateDecoration();
241 250
242 // Updates the zoom decoration in the omnibox with the current zoom level. 251 // Updates the zoom decoration in the omnibox with the current zoom level.
243 // Returns whether any updates were made. 252 // Returns whether any updates were made.
244 bool UpdateZoomDecoration(bool default_zoom_changed); 253 bool UpdateZoomDecoration(bool default_zoom_changed);
245 254
255 // Updates the security state bubble decoration.
256 void UpdateSecurityState(bool tab_changed);
257
258 // Returns true if |level| is SECURE or EV_SECURE.
259 bool IsSecureConnection(
260 security_state::SecurityStateModel::SecurityLevel level) const;
261
246 // Returns pointers to all of the LocationBarDecorations owned by this 262 // Returns pointers to all of the LocationBarDecorations owned by this
247 // LocationBarViewMac. This helper function is used for positioning and 263 // LocationBarViewMac. This helper function is used for positioning and
248 // re-positioning accessibility views. 264 // re-positioning accessibility views.
249 std::vector<LocationBarDecoration*> GetDecorations(); 265 std::vector<LocationBarDecoration*> GetDecorations();
250 266
251 // Updates |decoration|'s accessibility view's position to match the computed 267 // Updates |decoration|'s accessibility view's position to match the computed
252 // position the decoration will be drawn at. 268 // position the decoration will be drawn at.
253 void UpdateAccessibilityViewPosition(LocationBarDecoration* decoration); 269 void UpdateAccessibilityViewPosition(LocationBarDecoration* decoration);
254 270
255 std::unique_ptr<OmniboxViewMac> omnibox_view_; 271 std::unique_ptr<OmniboxViewMac> omnibox_view_;
256 272
257 AutocompleteTextField* field_; // owned by tab controller 273 AutocompleteTextField* field_; // owned by tab controller
258 274
259 // A decoration that shows an icon to the left of the address. 275 // A decoration that shows an icon to the left of the address.
260 std::unique_ptr<LocationIconDecoration> location_icon_decoration_; 276 std::unique_ptr<LocationIconDecoration> location_icon_decoration_;
261 277
262 // A decoration that shows the keyword-search bubble on the left. 278 // A decoration that shows the keyword-search bubble on the left.
263 std::unique_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; 279 std::unique_ptr<SelectedKeywordDecoration> selected_keyword_decoration_;
264 280
265 // A decoration that shows a lock icon and ev-cert label in a bubble 281 // A decoration that shows a security icon and the security state in a
266 // on the left. 282 // bubble on the left.
267 std::unique_ptr<EVBubbleDecoration> ev_bubble_decoration_; 283 std::unique_ptr<SecurityStateBubbleDecoration>
284 security_state_bubble_decoration_;
268 285
269 // Save credit card icon on the right side of the omnibox. 286 // Save credit card icon on the right side of the omnibox.
270 std::unique_ptr<SaveCreditCardDecoration> save_credit_card_decoration_; 287 std::unique_ptr<SaveCreditCardDecoration> save_credit_card_decoration_;
271 288
272 // Bookmark star right of page actions. 289 // Bookmark star right of page actions.
273 std::unique_ptr<StarDecoration> star_decoration_; 290 std::unique_ptr<StarDecoration> star_decoration_;
274 291
275 // Translate icon at the end of the ominibox. 292 // Translate icon at the end of the ominibox.
276 std::unique_ptr<TranslateDecoration> translate_decoration_; 293 std::unique_ptr<TranslateDecoration> translate_decoration_;
277 294
(...skipping 14 matching lines...) Expand all
292 std::unique_ptr<ManagePasswordsDecoration> manage_passwords_decoration_; 309 std::unique_ptr<ManagePasswordsDecoration> manage_passwords_decoration_;
293 310
294 Browser* browser_; 311 Browser* browser_;
295 312
296 // Used to change the visibility of the star decoration. 313 // Used to change the visibility of the star decoration.
297 BooleanPrefMember edit_bookmarks_enabled_; 314 BooleanPrefMember edit_bookmarks_enabled_;
298 315
299 // Indicates whether or not the location bar is currently visible. 316 // Indicates whether or not the location bar is currently visible.
300 bool location_bar_visible_; 317 bool location_bar_visible_;
301 318
319 bool is_width_narrow_;
320
321 // The security level of the location bar icon.
322 security_state::SecurityStateModel::SecurityLevel security_level_;
323
302 // Used to schedule a task for the first run info bubble. 324 // Used to schedule a task for the first run info bubble.
303 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; 325 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_;
304 326
305 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); 327 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac);
306 }; 328 };
307 329
308 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ 330 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698