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

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

Issue 11040055: Adds a FakeToolbarModel for use in testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: git try Created 8 years, 2 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/toolbar/test_toolbar_model.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 939ad2e39990a87afa81e1d2a4c2dddfbbbcf0f9..e25e66ed73de3639a2abef574f9dfebe7707b883 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.h
+++ b/chrome/browser/ui/toolbar/toolbar_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,13 +11,6 @@
#include "base/string16.h"
#include "googleurl/src/gurl.h"
-class Profile;
-class ToolbarModelDelegate;
-
-namespace content {
-class NavigationController;
-}
-
namespace net {
class X509Certificate;
}
@@ -40,8 +33,7 @@ class ToolbarModel {
NUM_SECURITY_LEVELS,
};
- explicit ToolbarModel(ToolbarModelDelegate* delegate);
- ~ToolbarModel();
+ virtual ~ToolbarModel() {}
// Returns the text for the current page's URL. This will have been formatted
// for display to the user:
@@ -50,59 +42,38 @@ class ToolbarModel {
// - 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;
+ virtual string16 GetText(bool display_search_urls_as_search_terms) const = 0;
// Returns the URL of the current navigation entry.
- GURL GetURL() const;
+ virtual GURL GetURL() const = 0;
// Returns true if a call to GetText(true) would successfully replace the URL
// with search terms.
- bool WouldReplaceSearchURLWithSearchTerms() const;
+ virtual bool WouldReplaceSearchURLWithSearchTerms() const = 0;
// Returns the security level that the toolbar should display.
- SecurityLevel GetSecurityLevel() const;
+ virtual SecurityLevel GetSecurityLevel() const = 0;
// Returns the resource_id of the icon to show to the left of the address,
// based on the current URL. This doesn't cover specialized icons while the
// user is editing; see OmniboxView::GetIcon().
- int GetIcon() const;
+ virtual int GetIcon() const = 0;
// Returns the name of the EV cert holder. Only call this when the security
// level is EV_SECURE.
- string16 GetEVCertName() const;
+ virtual string16 GetEVCertName() const = 0;
// Returns whether the URL for the current navigation entry should be
// in the location bar.
- bool ShouldDisplayURL() const;
+ virtual bool ShouldDisplayURL() const = 0;
// Getter/setter of whether the text in location bar is currently being
// edited.
- void set_input_in_progress(bool value) { input_in_progress_ = value; }
- bool input_in_progress() const { return input_in_progress_; }
-
- // Returns "<organization_name> [<country>]".
- static string16 GetEVCertName(const net::X509Certificate& cert);
-
- private:
- // Returns the navigation controller used to retrieve the navigation entry
- // from which the states are retrieved.
- // 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.
- bool input_in_progress_;
+ virtual void SetInputInProgress(bool value) = 0;
+ virtual bool GetInputInProgress() const = 0;
- DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel);
+ protected:
+ ToolbarModel() {}
};
#endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
« no previous file with comments | « chrome/browser/ui/toolbar/test_toolbar_model.cc ('k') | chrome/browser/ui/toolbar/toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698