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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 gfx::Rect WebContentsDelegate::GetRootWindowResizerRect() const { | 39 gfx::Rect WebContentsDelegate::GetRootWindowResizerRect() const { |
40 return gfx::Rect(); | 40 return gfx::Rect(); |
41 } | 41 } |
42 | 42 |
43 bool WebContentsDelegate::ShouldSuppressDialogs() { | 43 bool WebContentsDelegate::ShouldSuppressDialogs() { |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
47 void WebContentsDelegate::BeforeUnloadFired(WebContents* tab, | 47 void WebContentsDelegate::BeforeUnloadFired(WebContents* web_contents, |
48 bool proceed, | 48 bool proceed, |
49 bool* proceed_to_fire_unload) { | 49 bool* proceed_to_fire_unload) { |
50 *proceed_to_fire_unload = true; | 50 *proceed_to_fire_unload = true; |
51 } | 51 } |
52 | 52 |
53 bool WebContentsDelegate::ShouldFocusPageAfterCrash() { | 53 bool WebContentsDelegate::ShouldFocusPageAfterCrash() { |
54 return true; | 54 return true; |
55 } | 55 } |
56 | 56 |
57 bool WebContentsDelegate::TakeFocus(bool reverse) { | 57 bool WebContentsDelegate::TakeFocus(bool reverse) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 const string16& frame_name, | 127 const string16& frame_name, |
128 const GURL& target_url) { | 128 const GURL& target_url) { |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
132 JavaScriptDialogCreator* WebContentsDelegate::GetJavaScriptDialogCreator() { | 132 JavaScriptDialogCreator* WebContentsDelegate::GetJavaScriptDialogCreator() { |
133 return NULL; | 133 return NULL; |
134 } | 134 } |
135 | 135 |
136 bool WebContentsDelegate::IsFullscreenForTabOrPending( | 136 bool WebContentsDelegate::IsFullscreenForTabOrPending( |
137 const WebContents* tab) const { | 137 const WebContents* web_contents) const { |
138 return false; | 138 return false; |
139 } | 139 } |
140 | 140 |
141 content::ColorChooser* WebContentsDelegate::OpenColorChooser(WebContents* tab, | 141 content::ColorChooser* WebContentsDelegate::OpenColorChooser( |
| 142 WebContents* web_contents, |
142 int color_chooser_id, | 143 int color_chooser_id, |
143 const SkColor& color) { | 144 const SkColor& color) { |
144 return NULL; | 145 return NULL; |
145 } | 146 } |
146 | 147 |
147 void WebContentsDelegate::WebIntentDispatch( | 148 void WebContentsDelegate::WebIntentDispatch( |
148 WebContents* tab, | 149 WebContents* web_contents, |
149 WebIntentsDispatcher* intents_dispatcher) { | 150 WebIntentsDispatcher* intents_dispatcher) { |
150 // The caller passes this method ownership of the |intents_dispatcher|, but | 151 // The caller passes this method ownership of the |intents_dispatcher|, but |
151 // this empty implementation will not use it, so we delete it immediately. | 152 // this empty implementation will not use it, so we delete it immediately. |
152 delete intents_dispatcher; | 153 delete intents_dispatcher; |
153 } | 154 } |
154 | 155 |
155 WebContentsDelegate::~WebContentsDelegate() { | 156 WebContentsDelegate::~WebContentsDelegate() { |
156 while (!attached_contents_.empty()) { | 157 while (!attached_contents_.empty()) { |
157 WebContents* web_contents = *attached_contents_.begin(); | 158 WebContents* web_contents = *attached_contents_.begin(); |
158 web_contents->SetDelegate(NULL); | 159 web_contents->SetDelegate(NULL); |
159 } | 160 } |
160 DCHECK(attached_contents_.empty()); | 161 DCHECK(attached_contents_.empty()); |
161 } | 162 } |
162 | 163 |
163 void WebContentsDelegate::Attach(WebContents* web_contents) { | 164 void WebContentsDelegate::Attach(WebContents* web_contents) { |
164 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); | 165 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); |
165 attached_contents_.insert(web_contents); | 166 attached_contents_.insert(web_contents); |
166 } | 167 } |
167 | 168 |
168 void WebContentsDelegate::Detach(WebContents* web_contents) { | 169 void WebContentsDelegate::Detach(WebContents* web_contents) { |
169 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); | 170 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); |
170 attached_contents_.erase(web_contents); | 171 attached_contents_.erase(web_contents); |
171 } | 172 } |
172 | 173 |
173 } // namespace content | 174 } // namespace content |
OLD | NEW |