OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/public/browser/web_contents_delegate.h" | 5 #include "content/public/browser/web_contents_delegate.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_intents_dispatcher.h" | |
13 #include "content/public/common/url_constants.h" | 12 #include "content/public/common/url_constants.h" |
14 #include "content/public/common/bindings_policy.h" | 13 #include "content/public/common/bindings_policy.h" |
15 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
16 #include "webkit/glue/web_intent_data.h" | |
17 | 15 |
18 namespace content { | 16 namespace content { |
19 | 17 |
20 WebContentsDelegate::WebContentsDelegate() { | 18 WebContentsDelegate::WebContentsDelegate() { |
21 } | 19 } |
22 | 20 |
23 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, | 21 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, |
24 const OpenURLParams& params) { | 22 const OpenURLParams& params) { |
25 return NULL; | 23 return NULL; |
26 } | 24 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return false; | 132 return false; |
135 } | 133 } |
136 | 134 |
137 content::ColorChooser* WebContentsDelegate::OpenColorChooser( | 135 content::ColorChooser* WebContentsDelegate::OpenColorChooser( |
138 WebContents* web_contents, | 136 WebContents* web_contents, |
139 int color_chooser_id, | 137 int color_chooser_id, |
140 SkColor color) { | 138 SkColor color) { |
141 return NULL; | 139 return NULL; |
142 } | 140 } |
143 | 141 |
144 void WebContentsDelegate::WebIntentDispatch( | |
145 WebContents* web_contents, | |
146 WebIntentsDispatcher* intents_dispatcher) { | |
147 // The caller passes this method ownership of the |intents_dispatcher|, but | |
148 // this empty implementation will not use it, so we delete it immediately. | |
149 delete intents_dispatcher; | |
150 } | |
151 | |
152 bool WebContentsDelegate::RequestPpapiBrokerPermission( | 142 bool WebContentsDelegate::RequestPpapiBrokerPermission( |
153 WebContents* web_contents, | 143 WebContents* web_contents, |
154 const GURL& url, | 144 const GURL& url, |
155 const FilePath& plugin_path, | 145 const FilePath& plugin_path, |
156 const base::Callback<void(bool)>& callback) { | 146 const base::Callback<void(bool)>& callback) { |
157 return false; | 147 return false; |
158 } | 148 } |
159 | 149 |
160 WebContentsDelegate::~WebContentsDelegate() { | 150 WebContentsDelegate::~WebContentsDelegate() { |
161 while (!attached_contents_.empty()) { | 151 while (!attached_contents_.empty()) { |
162 WebContents* web_contents = *attached_contents_.begin(); | 152 WebContents* web_contents = *attached_contents_.begin(); |
163 web_contents->SetDelegate(NULL); | 153 web_contents->SetDelegate(NULL); |
164 } | 154 } |
165 DCHECK(attached_contents_.empty()); | 155 DCHECK(attached_contents_.empty()); |
166 } | 156 } |
167 | 157 |
168 void WebContentsDelegate::Attach(WebContents* web_contents) { | 158 void WebContentsDelegate::Attach(WebContents* web_contents) { |
169 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); | 159 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); |
170 attached_contents_.insert(web_contents); | 160 attached_contents_.insert(web_contents); |
171 } | 161 } |
172 | 162 |
173 void WebContentsDelegate::Detach(WebContents* web_contents) { | 163 void WebContentsDelegate::Detach(WebContents* web_contents) { |
174 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); | 164 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); |
175 attached_contents_.erase(web_contents); | 165 attached_contents_.erase(web_contents); |
176 } | 166 } |
177 | 167 |
178 } // namespace content | 168 } // namespace content |
OLD | NEW |