OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/guest_view/guest_view_base.h" | 5 #include "chrome/browser/guest_view/guest_view_base.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/guest_view/app_view/app_view_guest.h" | 10 #include "chrome/browser/guest_view/app_view/app_view_guest.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void GuestViewBase::Init( | 95 void GuestViewBase::Init( |
96 const std::string& embedder_extension_id, | 96 const std::string& embedder_extension_id, |
97 int embedder_render_process_id, | 97 int embedder_render_process_id, |
98 const base::DictionaryValue& create_params, | 98 const base::DictionaryValue& create_params, |
99 const WebContentsCreatedCallback& callback) { | 99 const WebContentsCreatedCallback& callback) { |
100 if (initialized_) | 100 if (initialized_) |
101 return; | 101 return; |
102 initialized_ = true; | 102 initialized_ = true; |
103 | 103 |
| 104 if (!CanEmbedderUseGuestView(embedder_extension_id)) { |
| 105 callback.Run(NULL); |
| 106 return; |
| 107 } |
| 108 |
104 CreateWebContents(embedder_extension_id, | 109 CreateWebContents(embedder_extension_id, |
105 embedder_render_process_id, | 110 embedder_render_process_id, |
106 create_params, | 111 create_params, |
107 base::Bind(&GuestViewBase::CompleteInit, | 112 base::Bind(&GuestViewBase::CompleteInit, |
108 AsWeakPtr(), | 113 AsWeakPtr(), |
109 embedder_extension_id, | 114 embedder_extension_id, |
110 embedder_render_process_id, | 115 embedder_render_process_id, |
111 callback)); | 116 callback)); |
112 } | 117 } |
113 | 118 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 // purpose. Let's self-destruct. | 364 // purpose. Let's self-destruct. |
360 delete this; | 365 delete this; |
361 callback.Run(NULL); | 366 callback.Run(NULL); |
362 return; | 367 return; |
363 } | 368 } |
364 InitWithWebContents(embedder_extension_id, | 369 InitWithWebContents(embedder_extension_id, |
365 embedder_render_process_id, | 370 embedder_render_process_id, |
366 guest_web_contents); | 371 guest_web_contents); |
367 callback.Run(guest_web_contents); | 372 callback.Run(guest_web_contents); |
368 } | 373 } |
OLD | NEW |