OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/developer_private/inspectable_views_find
er.h" | 5 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find
er.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_util.h" | 7 #include "chrome/browser/extensions/extension_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/extensions/api/developer_private.h" | 9 #include "chrome/common/extensions/api/developer_private.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 break; | 53 break; |
54 case VIEW_TYPE_BACKGROUND_CONTENTS: | 54 case VIEW_TYPE_BACKGROUND_CONTENTS: |
55 view->type = api::developer_private::VIEW_TYPE_BACKGROUND_CONTENTS; | 55 view->type = api::developer_private::VIEW_TYPE_BACKGROUND_CONTENTS; |
56 break; | 56 break; |
57 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: | 57 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: |
58 view->type = api::developer_private::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 58 view->type = api::developer_private::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
59 break; | 59 break; |
60 case VIEW_TYPE_EXTENSION_DIALOG: | 60 case VIEW_TYPE_EXTENSION_DIALOG: |
61 view->type = api::developer_private::VIEW_TYPE_EXTENSION_DIALOG; | 61 view->type = api::developer_private::VIEW_TYPE_EXTENSION_DIALOG; |
62 break; | 62 break; |
| 63 case VIEW_TYPE_EXTENSION_GUEST: |
| 64 view->type = api::developer_private::VIEW_TYPE_EXTENSION_GUEST; |
| 65 break; |
63 case VIEW_TYPE_EXTENSION_POPUP: | 66 case VIEW_TYPE_EXTENSION_POPUP: |
64 view->type = api::developer_private::VIEW_TYPE_EXTENSION_POPUP; | 67 view->type = api::developer_private::VIEW_TYPE_EXTENSION_POPUP; |
65 break; | 68 break; |
66 case VIEW_TYPE_LAUNCHER_PAGE: | 69 case VIEW_TYPE_LAUNCHER_PAGE: |
67 view->type = api::developer_private::VIEW_TYPE_LAUNCHER_PAGE; | 70 view->type = api::developer_private::VIEW_TYPE_LAUNCHER_PAGE; |
68 break; | 71 break; |
69 case VIEW_TYPE_PANEL: | 72 case VIEW_TYPE_PANEL: |
70 view->type = api::developer_private::VIEW_TYPE_PANEL; | 73 view->type = api::developer_private::VIEW_TYPE_PANEL; |
71 break; | 74 break; |
72 case VIEW_TYPE_TAB_CONTENTS: | 75 case VIEW_TYPE_TAB_CONTENTS: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 const Extension& extension, | 144 const Extension& extension, |
142 ProcessManager* process_manager, | 145 ProcessManager* process_manager, |
143 bool is_incognito, | 146 bool is_incognito, |
144 ViewList* result) { | 147 ViewList* result) { |
145 const std::set<content::RenderFrameHost*>& hosts = | 148 const std::set<content::RenderFrameHost*>& hosts = |
146 process_manager->GetRenderFrameHostsForExtension(extension.id()); | 149 process_manager->GetRenderFrameHostsForExtension(extension.id()); |
147 for (content::RenderFrameHost* host : hosts) { | 150 for (content::RenderFrameHost* host : hosts) { |
148 content::WebContents* web_contents = | 151 content::WebContents* web_contents = |
149 content::WebContents::FromRenderFrameHost(host); | 152 content::WebContents::FromRenderFrameHost(host); |
150 ViewType host_type = GetViewType(web_contents); | 153 ViewType host_type = GetViewType(web_contents); |
151 if (host_type == VIEW_TYPE_EXTENSION_POPUP || | 154 if (host_type == VIEW_TYPE_INVALID || |
152 host_type == VIEW_TYPE_EXTENSION_DIALOG) { | 155 host_type == VIEW_TYPE_EXTENSION_POPUP || |
| 156 host_type == VIEW_TYPE_EXTENSION_DIALOG || |
| 157 host_type == VIEW_TYPE_APP_WINDOW) { |
153 continue; | 158 continue; |
154 } | 159 } |
155 | 160 |
156 GURL url = web_contents->GetURL(); | 161 GURL url = web_contents->GetURL(); |
157 // If this is a background page that just opened, there might not be a | 162 // If this is a background page that just opened, there might not be a |
158 // committed (or visible) url yet. In this case, use the initial url. | 163 // committed (or visible) url yet. In this case, use the initial url. |
159 if (url.is_empty()) { | 164 if (url.is_empty()) { |
160 ExtensionHost* extension_host = | 165 ExtensionHost* extension_host = |
161 process_manager->GetExtensionHostForRenderFrameHost(host); | 166 process_manager->GetExtensionHostForRenderFrameHost(host); |
162 if (extension_host) | 167 if (extension_host) |
(...skipping 27 matching lines...) Expand all Loading... |
190 url = window->initial_url(); | 195 url = window->initial_url(); |
191 | 196 |
192 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); | 197 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); |
193 result->push_back(ConstructView( | 198 result->push_back(ConstructView( |
194 url, process->GetID(), web_contents->GetMainFrame()->GetRoutingID(), | 199 url, process->GetID(), web_contents->GetMainFrame()->GetRoutingID(), |
195 false, false, GetViewType(web_contents))); | 200 false, false, GetViewType(web_contents))); |
196 } | 201 } |
197 } | 202 } |
198 | 203 |
199 } // namespace extensions | 204 } // namespace extensions |
OLD | NEW |