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

Side by Side Diff: components/omnibox/browser/omnibox_view.h

Issue 2641003002: Show scheme in black and content in gray for data: protocol urls (Closed)
Patch Set: Update iOS Created 3 years, 9 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 // This file defines the interface class OmniboxView. Each toolkit will 5 // This file defines the interface class OmniboxView. Each toolkit will
6 // implement the edit view differently, so that code is inherently platform 6 // implement the edit view differently, so that code is inherently platform
7 // specific. However, the OmniboxEditModel needs to do some communication with 7 // specific. However, the OmniboxEditModel needs to do some communication with
8 // the view. Since the model is shared between platforms, we need to define an 8 // the view. Since the model is shared between platforms, we need to define an
9 // interface that all view implementations will share. 9 // interface that all view implementations will share.
10 10
11 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ 11 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_
12 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ 12 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_
13 13
14 #include <stddef.h> 14 #include <stddef.h>
15 15
16 #include <string> 16 #include <string>
17 17
18 #include "base/gtest_prod_util.h" 18 #include "base/gtest_prod_util.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "components/omnibox/browser/autocomplete_match.h" 23 #include "components/omnibox/browser/autocomplete_match.h"
24 #include "ui/base/window_open_disposition.h" 24 #include "ui/base/window_open_disposition.h"
25 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gfx/range/range.h"
26 27
27 class GURL; 28 class GURL;
28 class OmniboxClient; 29 class OmniboxClient;
29 class OmniboxEditController; 30 class OmniboxEditController;
30 class OmniboxViewMacTest; 31 class OmniboxViewMacTest;
31 class OmniboxEditModel; 32 class OmniboxEditModel;
32 33
33 namespace gfx { 34 namespace gfx {
34 enum class VectorIconId; 35 enum class VectorIconId;
35 } 36 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // |GetTextLength| can't be used as the Windows override of this class 253 // |GetTextLength| can't be used as the Windows override of this class
253 // inherits from a class that defines a method with that name. 254 // inherits from a class that defines a method with that name.
254 virtual int GetOmniboxTextLength() const = 0; 255 virtual int GetOmniboxTextLength() const = 0;
255 256
256 // Try to parse the current text as a URL and colorize the components. 257 // Try to parse the current text as a URL and colorize the components.
257 virtual void EmphasizeURLComponents() = 0; 258 virtual void EmphasizeURLComponents() = 0;
258 259
259 OmniboxEditController* controller() { return controller_; } 260 OmniboxEditController* controller() { return controller_; }
260 const OmniboxEditController* controller() const { return controller_; } 261 const OmniboxEditController* controller() const { return controller_; }
261 262
263 // Subclasses use this to set colors on ranges of the text. Pass an invalid
264 // range to indicate the base level of emphasis for the text.
Peter Kasting 2017/03/01 02:39:11 Nit: Maybe this would be more descriptive while be
elawrence 2017/03/01 21:49:02 Done.
265 virtual void SetEmphasis(bool emphasize, gfx::Range);
Peter Kasting 2017/03/01 02:39:11 I'd make these two functions pure virtual. All su
Robert Sesek 2017/03/01 18:29:45 The gfx::Range argument here and on line 269 could
elawrence 2017/03/01 21:49:01 Done.
elawrence 2017/03/01 21:49:02 Done.
266
267 // Subclasses use this to apply styles to the scheme based on the security
268 // state. An invalid range indicates that the text does not contain a scheme.
269 virtual void UpdateSchemeEmphasis(gfx::Range range);
Peter Kasting 2017/03/01 02:39:11 Nit: I might call this UpdateSchemeStyle() or some
elawrence 2017/03/01 21:49:01 Done.
270
271 // Deemphasize parts of the URL to draw attention to whatever best represents
Peter Kasting 2017/03/01 02:39:11 Nit: Descriptive, not imperative
elawrence 2017/03/01 21:49:02 Done.
272 // the "identity" of the URL.
273 void ApplyEmphasis(const base::string16& display_text,
Peter Kasting 2017/03/01 02:39:11 Nit: I wonder if this title is too specific now th
elawrence 2017/03/01 21:49:02 Done.
274 const AutocompleteSchemeClassifier& classifier);
275
262 private: 276 private:
263 friend class OmniboxViewMacTest; 277 friend class OmniboxViewMacTest;
264 278
265 // |model_| can be NULL in tests. 279 // |model_| can be NULL in tests.
266 std::unique_ptr<OmniboxEditModel> model_; 280 std::unique_ptr<OmniboxEditModel> model_;
267 OmniboxEditController* controller_; 281 OmniboxEditController* controller_;
268 282
269 DISALLOW_COPY_AND_ASSIGN(OmniboxView); 283 DISALLOW_COPY_AND_ASSIGN(OmniboxView);
270 }; 284 };
271 285
272 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ 286 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698