Chromium Code Reviews| 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_TOOLBAR_TOOLBAR_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "googleurl/src/gurl.h" | |
| 12 | 13 |
| 14 class Profile; | |
| 13 class ToolbarModelDelegate; | 15 class ToolbarModelDelegate; |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 class NavigationController; | 18 class NavigationController; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace net { | 21 namespace net { |
| 20 class X509Certificate; | 22 class X509Certificate; |
| 21 } | 23 } |
| 22 | 24 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 33 EV_SECURE, // HTTPS with valid EV cert | 35 EV_SECURE, // HTTPS with valid EV cert |
| 34 SECURE, // HTTPS (non-EV) | 36 SECURE, // HTTPS (non-EV) |
| 35 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation | 37 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation |
| 36 // status or with insecure content on the page | 38 // status or with insecure content on the page |
| 37 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated | 39 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated |
| 38 NUM_SECURITY_LEVELS, | 40 NUM_SECURITY_LEVELS, |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 explicit ToolbarModel(ToolbarModelDelegate* delegate); | 43 explicit ToolbarModel(ToolbarModelDelegate* delegate); |
| 42 ~ToolbarModel(); | 44 ~ToolbarModel(); |
| 45 // Returns the text for the current page's URL. This will have been formatted | |
|
sky
2012/08/23 22:44:26
nit: newline between 44/45
dominich
2012/08/24 15:51:07
Done.
| |
| 46 // for display to the user: | |
| 47 // - Some characters may be unescaped. | |
| 48 // - The scheme and/or trailing slash may be dropped. | |
| 49 // - if |display_search_urls_as_search_terms| is true, the query will be | |
| 50 // extracted from search URLs for the user's default search engine and those | |
| 51 // will be displayed in place of the URL. | |
| 52 string16 GetText(bool display_search_urls_as_search_terms) const; | |
| 43 | 53 |
| 44 // Returns the text that should be displayed in the location bar. | 54 // Returns the URL of the current navigation entry. |
| 45 string16 GetText() const; | 55 GURL GetURL() const; |
| 56 | |
| 57 // Returns true if a call to GetText(true) would successfully replace the URL | |
| 58 // with search terms. | |
| 59 bool WouldReplaceSearchURLWithSearchTerms() const; | |
|
sky
2012/08/23 22:44:26
Isn't this something like IsURLFromDefaultSearchPr
dominich
2012/08/24 15:51:07
No. In this temporary version we're restricting to
| |
| 46 | 60 |
| 47 // Returns the security level that the toolbar should display. | 61 // Returns the security level that the toolbar should display. |
| 48 SecurityLevel GetSecurityLevel() const; | 62 SecurityLevel GetSecurityLevel() const; |
| 49 | 63 |
| 50 // Returns the resource_id of the icon to show to the left of the address, | 64 // Returns the resource_id of the icon to show to the left of the address, |
| 51 // based on the current URL. This doesn't cover specialized icons while the | 65 // based on the current URL. This doesn't cover specialized icons while the |
| 52 // user is editing; see OmniboxView::GetIcon(). | 66 // user is editing; see OmniboxView::GetIcon(). |
| 53 int GetIcon() const; | 67 int GetIcon() const; |
| 54 | 68 |
| 55 // Returns the name of the EV cert holder. Only call this when the security | 69 // Returns the name of the EV cert holder. Only call this when the security |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 67 | 81 |
| 68 // Returns "<organization_name> [<country>]". | 82 // Returns "<organization_name> [<country>]". |
| 69 static string16 GetEVCertName(const net::X509Certificate& cert); | 83 static string16 GetEVCertName(const net::X509Certificate& cert); |
| 70 | 84 |
| 71 private: | 85 private: |
| 72 // Returns the navigation controller used to retrieve the navigation entry | 86 // Returns the navigation controller used to retrieve the navigation entry |
| 73 // from which the states are retrieved. | 87 // from which the states are retrieved. |
| 74 // If this returns NULL, default values are used. | 88 // If this returns NULL, default values are used. |
| 75 content::NavigationController* GetNavigationController() const; | 89 content::NavigationController* GetNavigationController() const; |
| 76 | 90 |
| 91 // Attempt to extract search terms from |url|. Called by GetText if | |
| 92 // |display_search_urls_as_search_terms| is true and by | |
| 93 // WouldReplaceSearchURLWithSearchTerms. | |
| 94 string16 TryToExtractSearchTermsFromURL(const GURL& url) const; | |
| 95 | |
| 96 // Helper method to extract the profile from the navigation controller. | |
| 97 Profile* GetProfile() const; | |
| 98 | |
| 77 ToolbarModelDelegate* delegate_; | 99 ToolbarModelDelegate* delegate_; |
| 78 | 100 |
| 79 // Whether the text in the location bar is currently being edited. | 101 // Whether the text in the location bar is currently being edited. |
| 80 bool input_in_progress_; | 102 bool input_in_progress_; |
| 81 | 103 |
| 82 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); | 104 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); |
| 83 }; | 105 }; |
| 84 | 106 |
| 85 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 107 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |