blob: 8a24a3d45f01a17d06b4986ff79a54c4b221a2f9 [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// Copyright (c) 2006-2008 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.
initial.commit09911bf2008-07-26 23:55:294
5#include "chrome/browser/navigation_entry.h"
6
7#include "chrome/common/resource_bundle.h"
8
[email protected]1e5645ff2008-08-27 18:09:079// Use this to get a new unique ID for a NavigationEntry during construction.
10// The returned ID is guaranteed to be nonzero (which is the "no ID" indicator).
11static int GetUniqueID() {
12 static int unique_id_counter = 0;
13 return ++unique_id_counter;
14}
initial.commit09911bf2008-07-26 23:55:2915
[email protected]eb34392b2008-08-19 15:42:2016NavigationEntry::SSLStatus::SSLStatus()
17 : security_style_(SECURITY_STYLE_UNKNOWN),
18 cert_id_(0),
19 cert_status_(0),
20 security_bits_(-1),
21 content_status_(NORMAL_CONTENT) {
22}
23
[email protected]1e5645ff2008-08-27 18:09:0724NavigationEntry::FaviconStatus::FaviconStatus() : valid_(false) {
25 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
26 bitmap_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
27}
28
initial.commit09911bf2008-07-26 23:55:2929NavigationEntry::NavigationEntry(TabContentsType type)
[email protected]1e5645ff2008-08-27 18:09:0730 : unique_id_(GetUniqueID()),
31 tab_type_(type),
initial.commit09911bf2008-07-26 23:55:2932 site_instance_(NULL),
[email protected]1e5645ff2008-08-27 18:09:0733 page_type_(NORMAL_PAGE),
initial.commit09911bf2008-07-26 23:55:2934 page_id_(-1),
initial.commit09911bf2008-07-26 23:55:2935 transition_type_(PageTransition::LINK),
initial.commit09911bf2008-07-26 23:55:2936 has_post_data_(false),
37 restored_(false) {
initial.commit09911bf2008-07-26 23:55:2938}
39
40NavigationEntry::NavigationEntry(TabContentsType type,
41 SiteInstance* instance,
42 int page_id,
43 const GURL& url,
44 const std::wstring& title,
45 PageTransition::Type transition_type)
[email protected]1e5645ff2008-08-27 18:09:0746 : unique_id_(GetUniqueID()),
47 tab_type_(type),
initial.commit09911bf2008-07-26 23:55:2948 site_instance_(instance),
[email protected]1e5645ff2008-08-27 18:09:0749 page_type_(NORMAL_PAGE),
initial.commit09911bf2008-07-26 23:55:2950 url_(url),
initial.commit09911bf2008-07-26 23:55:2951 title_(title),
[email protected]1e5645ff2008-08-27 18:09:0752 page_id_(page_id),
initial.commit09911bf2008-07-26 23:55:2953 transition_type_(transition_type),
initial.commit09911bf2008-07-26 23:55:2954 has_post_data_(false),
55 restored_(false) {
initial.commit09911bf2008-07-26 23:55:2956}
[email protected]3d627bbc2008-10-23 20:49:0757
58const std::wstring& NavigationEntry::GetTitleForDisplay() {
59 if (title_.empty())
60 return url_as_string_;
61 return title_;
62}