| 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 11 matching lines...) Expand all Loading... |
| 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(); |
| 43 | 45 |
| 44 // Returns the text that should be displayed in the location bar. | 46 // Returns the text for the current page's URL. This will have been formatted |
| 45 string16 GetText() const; | 47 // for display to the user: |
| 48 // - Some characters may be unescaped. |
| 49 // - The scheme and/or trailing slash may be dropped. |
| 50 // - if |display_search_urls_as_search_terms| is true, the query will be |
| 51 // extracted from search URLs for the user's default search engine and those |
| 52 // will be displayed in place of the URL. |
| 53 string16 GetText(bool display_search_urls_as_search_terms) const; |
| 54 |
| 55 // Returns the URL of the current navigation entry. |
| 56 GURL GetURL() const; |
| 57 |
| 58 // Returns true if a call to GetText(true) would successfully replace the URL |
| 59 // with search terms. |
| 60 bool WouldReplaceSearchURLWithSearchTerms() const; |
| 46 | 61 |
| 47 // Returns the security level that the toolbar should display. | 62 // Returns the security level that the toolbar should display. |
| 48 SecurityLevel GetSecurityLevel() const; | 63 SecurityLevel GetSecurityLevel() const; |
| 49 | 64 |
| 50 // Returns the resource_id of the icon to show to the left of the address, | 65 // 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 | 66 // based on the current URL. This doesn't cover specialized icons while the |
| 52 // user is editing; see OmniboxView::GetIcon(). | 67 // user is editing; see OmniboxView::GetIcon(). |
| 53 int GetIcon() const; | 68 int GetIcon() const; |
| 54 | 69 |
| 55 // Returns the name of the EV cert holder. Only call this when the security | 70 // Returns the name of the EV cert holder. Only call this when the security |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 | 82 |
| 68 // Returns "<organization_name> [<country>]". | 83 // Returns "<organization_name> [<country>]". |
| 69 static string16 GetEVCertName(const net::X509Certificate& cert); | 84 static string16 GetEVCertName(const net::X509Certificate& cert); |
| 70 | 85 |
| 71 private: | 86 private: |
| 72 // Returns the navigation controller used to retrieve the navigation entry | 87 // Returns the navigation controller used to retrieve the navigation entry |
| 73 // from which the states are retrieved. | 88 // from which the states are retrieved. |
| 74 // If this returns NULL, default values are used. | 89 // If this returns NULL, default values are used. |
| 75 content::NavigationController* GetNavigationController() const; | 90 content::NavigationController* GetNavigationController() const; |
| 76 | 91 |
| 92 // Attempt to extract search terms from |url|. Called by GetText if |
| 93 // |display_search_urls_as_search_terms| is true and by |
| 94 // WouldReplaceSearchURLWithSearchTerms. |
| 95 string16 TryToExtractSearchTermsFromURL(const GURL& url) const; |
| 96 |
| 97 // Helper method to extract the profile from the navigation controller. |
| 98 Profile* GetProfile() const; |
| 99 |
| 77 ToolbarModelDelegate* delegate_; | 100 ToolbarModelDelegate* delegate_; |
| 78 | 101 |
| 79 // Whether the text in the location bar is currently being edited. | 102 // Whether the text in the location bar is currently being edited. |
| 80 bool input_in_progress_; | 103 bool input_in_progress_; |
| 81 | 104 |
| 82 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); | 105 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); |
| 83 }; | 106 }; |
| 84 | 107 |
| 85 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 108 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |