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

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: use url_parse 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
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..203ceca5e90a81219b5b0dfa50711e3516eb42f0 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 {
@@ -40,9 +42,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
sky 2012/08/23 22:44:26 nit: newline between 44/45
dominich 2012/08/24 15:51:07 Done.
+ // 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;
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
// Returns the security level that the toolbar should display.
SecurityLevel GetSecurityLevel() const;
@@ -74,6 +88,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.

Powered by Google App Engine
This is Rietveld 408576698