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

Unified Diff: chrome/browser/ui/toolbar/toolbar_model.h

Issue 10867038: A simple version of search term replacement for testing . (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added whitespace Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc ('k') | chrome/browser/ui/toolbar/toolbar_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/toolbar/toolbar_model.h
diff --git a/chrome/browser/ui/toolbar/toolbar_model.h b/chrome/browser/ui/toolbar/toolbar_model.h
index e774ff22be13e172653c07fe90b779f5f592d078..939ad2e39990a87afa81e1d2a4c2dddfbbbcf0f9 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.h
+++ b/chrome/browser/ui/toolbar/toolbar_model.h
@@ -9,7 +9,9 @@
#include "base/basictypes.h"
#include "base/string16.h"
+#include "googleurl/src/gurl.h"
+class Profile;
class ToolbarModelDelegate;
namespace content {
@@ -41,8 +43,21 @@ class ToolbarModel {
explicit ToolbarModel(ToolbarModelDelegate* delegate);
~ToolbarModel();
- // Returns the text that should be displayed in the location bar.
- string16 GetText() const;
+ // Returns the text for the current page's URL. This will have been formatted
+ // for display to the user:
+ // - Some characters may be unescaped.
+ // - The scheme and/or trailing slash may be dropped.
+ // - if |display_search_urls_as_search_terms| is true, the query will be
+ // extracted from search URLs for the user's default search engine and those
+ // will be displayed in place of the URL.
+ string16 GetText(bool display_search_urls_as_search_terms) const;
+
+ // Returns the URL of the current navigation entry.
+ GURL GetURL() const;
+
+ // Returns true if a call to GetText(true) would successfully replace the URL
+ // with search terms.
+ bool WouldReplaceSearchURLWithSearchTerms() const;
// Returns the security level that the toolbar should display.
SecurityLevel GetSecurityLevel() const;
@@ -74,6 +89,14 @@ class ToolbarModel {
// If this returns NULL, default values are used.
content::NavigationController* GetNavigationController() const;
+ // Attempt to extract search terms from |url|. Called by GetText if
+ // |display_search_urls_as_search_terms| is true and by
+ // WouldReplaceSearchURLWithSearchTerms.
+ string16 TryToExtractSearchTermsFromURL(const GURL& url) const;
+
+ // Helper method to extract the profile from the navigation controller.
+ Profile* GetProfile() const;
+
ToolbarModelDelegate* delegate_;
// Whether the text in the location bar is currently being edited.
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc ('k') | chrome/browser/ui/toolbar/toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698