| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 
|  | 2 // Use of this source code is governed by a BSD-style license that can be | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 
|  | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 
|  | 7 | 
|  | 8 #include <string> | 
|  | 9 | 
|  | 10 #include "base/basictypes.h" | 
|  | 11 #include "base/compiler_specific.h" | 
|  | 12 #include "base/string16.h" | 
|  | 13 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 
|  | 14 #include "googleurl/src/gurl.h" | 
|  | 15 | 
|  | 16 class Profile; | 
|  | 17 class ToolbarModelDelegate; | 
|  | 18 | 
|  | 19 namespace content { | 
|  | 20 class NavigationController; | 
|  | 21 } | 
|  | 22 | 
|  | 23 namespace net { | 
|  | 24 class X509Certificate; | 
|  | 25 } | 
|  | 26 | 
|  | 27 // This class is the model used by the toolbar, location bar and autocomplete | 
|  | 28 // edit.  It populates its states from the current navigation entry retrieved | 
|  | 29 // from the navigation controller returned by GetNavigationController(). | 
|  | 30 class ToolbarModelImpl : public ToolbarModel { | 
|  | 31  public: | 
|  | 32   explicit ToolbarModelImpl(ToolbarModelDelegate* delegate); | 
|  | 33   virtual ~ToolbarModelImpl(); | 
|  | 34 | 
|  | 35   // Overriden from ToolbarModel. | 
|  | 36   virtual string16 GetText( | 
|  | 37       bool display_search_urls_as_search_terms) const OVERRIDE; | 
|  | 38   virtual GURL GetURL() const OVERRIDE; | 
|  | 39   virtual bool WouldReplaceSearchURLWithSearchTerms() const OVERRIDE; | 
|  | 40   virtual SecurityLevel GetSecurityLevel() const OVERRIDE; | 
|  | 41   virtual int GetIcon() const OVERRIDE; | 
|  | 42   virtual string16 GetEVCertName() const OVERRIDE; | 
|  | 43   virtual bool ShouldDisplayURL() const OVERRIDE; | 
|  | 44   virtual void SetInputInProgress(bool value) OVERRIDE; | 
|  | 45   virtual bool GetInputInProgress() const OVERRIDE; | 
|  | 46 | 
|  | 47   // Returns "<organization_name> [<country>]". | 
|  | 48   static string16 GetEVCertName(const net::X509Certificate& cert); | 
|  | 49 | 
|  | 50  private: | 
|  | 51   // Returns the navigation controller used to retrieve the navigation entry | 
|  | 52   // from which the states are retrieved. | 
|  | 53   // If this returns NULL, default values are used. | 
|  | 54   content::NavigationController* GetNavigationController() const; | 
|  | 55 | 
|  | 56   // Attempt to extract search terms from |url|. Called by GetText if | 
|  | 57   // |display_search_urls_as_search_terms| is true and by | 
|  | 58   // WouldReplaceSearchURLWithSearchTerms. | 
|  | 59   string16 TryToExtractSearchTermsFromURL(const GURL& url) const; | 
|  | 60 | 
|  | 61   // Helper method to extract the profile from the navigation controller. | 
|  | 62   Profile* GetProfile() const; | 
|  | 63 | 
|  | 64   ToolbarModelDelegate* delegate_; | 
|  | 65 | 
|  | 66   // Whether the text in the location bar is currently being edited. | 
|  | 67   bool input_in_progress_; | 
|  | 68 | 
|  | 69   DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); | 
|  | 70 }; | 
|  | 71 | 
|  | 72 #endif  // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 
| OLD | NEW | 
|---|