blob: 06050c1c63c35a5c7b9fec6e074abe770462217d [file] [log] [blame]
[email protected]69c579e2010-04-23 20:01:001// Copyright (c) 2010 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
5#ifndef CHROME_BROWSER_TOOLBAR_MODEL_H__
6#define CHROME_BROWSER_TOOLBAR_MODEL_H__
[email protected]32b76ef2010-07-26 23:08:247#pragma once
initial.commit09911bf2008-07-26 23:55:298
9#include <string>
10
11#include "base/basictypes.h"
initial.commit09911bf2008-07-26 23:55:2912
[email protected]b023ab02010-01-28 22:25:4513class Browser;
initial.commit09911bf2008-07-26 23:55:2914class NavigationController;
initial.commit09911bf2008-07-26 23:55:2915
16// This class is the model used by the toolbar, location bar and autocomplete
17// edit. It populates its states from the current navigation entry retrieved
18// from the navigation controller returned by GetNavigationController().
initial.commit09911bf2008-07-26 23:55:2919class ToolbarModel {
20 public:
[email protected]69c579e2010-04-23 20:01:0021 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We
22 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED
23 // needs to be refined into three levels: warning, standard, and EV.
initial.commit09911bf2008-07-26 23:55:2924 enum SecurityLevel {
[email protected]69c579e2010-04-23 20:01:0025 NONE = 0, // HTTP/no URL/user is editing
26 EV_SECURE, // HTTPS with valid EV cert
27 SECURE, // HTTPS (non-EV)
28 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation
[email protected]b4e75c12010-05-18 18:28:4829 // status or with insecure content on the page
[email protected]69c579e2010-04-23 20:01:0030 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated
31 NUM_SECURITY_LEVELS,
[email protected]d4cafaf2009-06-25 03:06:2832 };
33
[email protected]b023ab02010-01-28 22:25:4534 explicit ToolbarModel(Browser* browser);
35 ~ToolbarModel();
initial.commit09911bf2008-07-26 23:55:2936
37 // Returns the text that should be displayed in the location bar.
[email protected]b023ab02010-01-28 22:25:4538 std::wstring GetText() const;
initial.commit09911bf2008-07-26 23:55:2939
40 // Returns the security level that the toolbar should display.
[email protected]b023ab02010-01-28 22:25:4541 SecurityLevel GetSecurityLevel() const;
initial.commit09911bf2008-07-26 23:55:2942
[email protected]69c579e2010-04-23 20:01:0043 // Returns the resource_id of the icon to show to the left of the address,
44 // based on the current URL. This doesn't cover specialized icons while the
45 // user is editing; see AutocompleteEditView::GetIcon().
46 int GetIcon() const;
initial.commit09911bf2008-07-26 23:55:2947
[email protected]69c579e2010-04-23 20:01:0048 // Returns the name of the EV cert holder. Only call this when the security
49 // level is EV_SECURE.
50 std::wstring GetEVCertName() const;
initial.commit09911bf2008-07-26 23:55:2951
52 // Getter/setter of whether the text in location bar is currently being
53 // edited.
[email protected]b023ab02010-01-28 22:25:4554 void set_input_in_progress(bool value) { input_in_progress_ = value; }
55 bool input_in_progress() const { return input_in_progress_; }
initial.commit09911bf2008-07-26 23:55:2956
[email protected]b023ab02010-01-28 22:25:4557 private:
initial.commit09911bf2008-07-26 23:55:2958 // Returns the navigation controller used to retrieve the navigation entry
59 // from which the states are retrieved.
60 // If this returns NULL, default values are used.
[email protected]b023ab02010-01-28 22:25:4561 NavigationController* GetNavigationController() const;
initial.commit09911bf2008-07-26 23:55:2962
[email protected]b023ab02010-01-28 22:25:4563 Browser* browser_;
initial.commit09911bf2008-07-26 23:55:2964
65 // Whether the text in the location bar is currently being edited.
66 bool input_in_progress_;
67
[email protected]b023ab02010-01-28 22:25:4568 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel);
initial.commit09911bf2008-07-26 23:55:2969};
70
71#endif // CHROME_BROWSER_TOOLBAR_MODEL_H__