summaryrefslogtreecommitdiffstats
path: root/content/browser/tab_contents/tab_contents_observer.cc
blob: 1ffbf5a6420bd8a30c1e7904903b3832a252584f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Copyright (c) 2011 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.

#include "content/browser/tab_contents/tab_contents_observer.h"

#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/tab_contents.h"

void TabContentsObserver::RenderViewCreated(RenderViewHost* render_view_host) {
}

void TabContentsObserver::RenderViewDeleted(RenderViewHost* render_view_host) {
}

void TabContentsObserver::RenderViewReady() {
}

void TabContentsObserver::RenderViewGone(base::TerminationStatus status) {
}

void TabContentsObserver::NavigateToPendingEntry(
    const GURL& url,
    NavigationController::ReloadType reload_type) {
}

void TabContentsObserver::DidNavigateMainFrame(
    const content::LoadCommittedDetails& details,
    const content::FrameNavigateParams& params) {
}

void TabContentsObserver::DidNavigateAnyFrame(
    const content::LoadCommittedDetails& details,
    const content::FrameNavigateParams& params) {
}

void TabContentsObserver::DidStartProvisionalLoadForFrame(
    int64 frame_id,
    bool is_main_frame,
    const GURL& validated_url,
    bool is_error_page,
    RenderViewHost* render_view_host) {
}

void TabContentsObserver::ProvisionalChangeToMainFrameUrl(
    const GURL& url,
    const GURL& opener_url) {
}

void TabContentsObserver::DidCommitProvisionalLoadForFrame(
    int64 frame_id,
    bool is_main_frame,
    const GURL& url,
    content::PageTransition transition_type) {
}

void TabContentsObserver::DidFailProvisionalLoad(
    int64 frame_id,
    bool is_main_frame,
    const GURL& validated_url,
    int error_code,
    const string16& error_description) {
}

void TabContentsObserver::DocumentAvailableInMainFrame() {
}

void TabContentsObserver::DocumentLoadedInFrame(int64 frame_id) {
}

void TabContentsObserver::DidFinishLoad(
     int64 frame_id,
     const GURL& validated_url,
     bool is_main_frame) {
}

void TabContentsObserver::DidFailLoad(int64 frame_id,
                                      const GURL& validated_url,
                                      bool is_main_frame,
                                      int error_code,
                                      const string16& error_description) {
}

void TabContentsObserver::DidGetUserGesture() {
}

void TabContentsObserver::DidGetIgnoredUIEvent() {
}

void TabContentsObserver::DidBecomeSelected() {
}

void TabContentsObserver::DidStartLoading() {
}

void TabContentsObserver::DidStopLoading() {
}

void TabContentsObserver::StopNavigation() {
}

void TabContentsObserver::DidOpenURL(const GURL& url,
                                     const content::Referrer& referrer,
                                     WindowOpenDisposition disposition,
                                     content::PageTransition transition) {
}

void TabContentsObserver::DidOpenRequestedURL(
    TabContents* new_contents,
    const GURL& url,
    const content::Referrer& referrer,
    WindowOpenDisposition disposition,
    content::PageTransition transition,
    int64 source_frame_id) {
}

void TabContentsObserver::AppCacheAccessed(const GURL& manifest_url,
                                           bool blocked_by_policy) {
}

TabContentsObserver::TabContentsObserver(TabContents* tab_contents)
    : tab_contents_(NULL) {
  Observe(tab_contents);
}

TabContentsObserver::TabContentsObserver()
    : tab_contents_(NULL) {
}

TabContentsObserver::~TabContentsObserver() {
  if (tab_contents_)
    tab_contents_->RemoveObserver(this);
}

void TabContentsObserver::Observe(TabContents* tab_contents) {
  if (tab_contents_)
    tab_contents_->RemoveObserver(this);
  tab_contents_ = tab_contents;
  if (tab_contents_) {
    tab_contents_->AddObserver(this);
  }
}

void TabContentsObserver::TabContentsDestroyed(TabContents* tab) {
}

bool TabContentsObserver::OnMessageReceived(const IPC::Message& message) {
  return false;
}

bool TabContentsObserver::Send(IPC::Message* message) {
  if (!tab_contents_ || !tab_contents_->render_view_host()) {
    delete message;
    return false;
  }

  return tab_contents_->render_view_host()->Send(message);
}

int TabContentsObserver::routing_id() const {
  if (!tab_contents_ || !tab_contents_->render_view_host())
    return MSG_ROUTING_NONE;

  return tab_contents_->render_view_host()->routing_id();
}

void TabContentsObserver::TabContentsDestroyed() {
  // Do cleanup so that 'this' can safely be deleted from
  // TabContentsDestroyed.
  tab_contents_->RemoveObserver(this);
  TabContents* tab = tab_contents_;
  tab_contents_ = NULL;
  TabContentsDestroyed(tab);
}