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

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

Issue 11040055: Adds a FakeToolbarModel for use in testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: renamed methods and fixed usage 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
Index: chrome/browser/ui/toolbar/toolbar_model_impl.h
diff --git a/chrome/browser/ui/toolbar/toolbar_model.h b/chrome/browser/ui/toolbar/toolbar_model_impl.h
similarity index 61%
copy from chrome/browser/ui/toolbar/toolbar_model.h
copy to chrome/browser/ui/toolbar/toolbar_model_impl.h
index 939ad2e39990a87afa81e1d2a4c2dddfbbbcf0f9..6d3d8a86067ddf3ee14d3fdca186c1a7d17243b4 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.h
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.h
@@ -1,14 +1,16 @@
-// 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.
-#ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
-#define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
+#ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_
+#define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_
#include <string>
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/string16.h"
+#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "googleurl/src/gurl.h"
class Profile;
@@ -25,23 +27,10 @@ class X509Certificate;
// This class is the model used by the toolbar, location bar and autocomplete
// edit. It populates its states from the current navigation entry retrieved
// from the navigation controller returned by GetNavigationController().
-class ToolbarModel {
+class ToolbarModelImpl : public ToolbarModel {
public:
- // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We
- // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED
- // needs to be refined into three levels: warning, standard, and EV.
- enum SecurityLevel {
- NONE = 0, // HTTP/no URL/user is editing
- EV_SECURE, // HTTPS with valid EV cert
- SECURE, // HTTPS (non-EV)
- SECURITY_WARNING, // HTTPS, but unable to check certificate revocation
- // status or with insecure content on the page
- SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated
- NUM_SECURITY_LEVELS,
- };
-
- explicit ToolbarModel(ToolbarModelDelegate* delegate);
- ~ToolbarModel();
+ explicit ToolbarModelImpl(ToolbarModelDelegate* delegate);
+ virtual ~ToolbarModelImpl();
// Returns the text for the current page's URL. This will have been formatted
sky 2012/10/10 21:17:36 Don't duplicate all the comments here. Just remove
lliabraa 2012/10/11 18:14:59 Done.
// for display to the user:
@@ -50,38 +39,36 @@ 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 OVERRIDE;
// Returns the URL of the current navigation entry.
- GURL GetURL() const;
+ virtual GURL GetURL() const OVERRIDE;
// Returns true if a call to GetText(true) would successfully replace the URL
// with search terms.
- bool WouldReplaceSearchURLWithSearchTerms() const;
+ virtual bool WouldReplaceSearchURLWithSearchTerms() const OVERRIDE;
// Returns the security level that the toolbar should display.
- SecurityLevel GetSecurityLevel() const;
+ virtual SecurityLevel GetSecurityLevel() const OVERRIDE;
// 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 OVERRIDE;
// 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 OVERRIDE;
// Returns whether the URL for the current navigation entry should be
// in the location bar.
- bool ShouldDisplayURL() const;
+ virtual bool ShouldDisplayURL() const OVERRIDE;
// 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);
+ virtual void SetInputInProgress(bool value) OVERRIDE;
+ virtual bool GetInputInProgress() const OVERRIDE;
private:
// Returns the navigation controller used to retrieve the navigation entry
@@ -102,7 +89,7 @@ class ToolbarModel {
// Whether the text in the location bar is currently being edited.
bool input_in_progress_;
- DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl);
};
-#endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
+#endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698