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/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/common/extensions/api/developer_private.h" | 8 #include "chrome/common/extensions/api/developer_private.h" |
9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 break; | 52 break; |
53 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: | 53 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: |
54 view->type = api::developer_private::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 54 view->type = api::developer_private::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
55 break; | 55 break; |
56 case VIEW_TYPE_EXTENSION_DIALOG: | 56 case VIEW_TYPE_EXTENSION_DIALOG: |
57 view->type = api::developer_private::VIEW_TYPE_EXTENSION_DIALOG; | 57 view->type = api::developer_private::VIEW_TYPE_EXTENSION_DIALOG; |
58 break; | 58 break; |
59 case VIEW_TYPE_EXTENSION_POPUP: | 59 case VIEW_TYPE_EXTENSION_POPUP: |
60 view->type = api::developer_private::VIEW_TYPE_EXTENSION_POPUP; | 60 view->type = api::developer_private::VIEW_TYPE_EXTENSION_POPUP; |
61 break; | 61 break; |
| 62 case VIEW_TYPE_EXTENSION_SIDEBAR: |
| 63 view->type = api::developer_private::VIEW_TYPE_EXTENSION_SIDEBAR; |
| 64 break; |
62 case VIEW_TYPE_LAUNCHER_PAGE: | 65 case VIEW_TYPE_LAUNCHER_PAGE: |
63 view->type = api::developer_private::VIEW_TYPE_LAUNCHER_PAGE; | 66 view->type = api::developer_private::VIEW_TYPE_LAUNCHER_PAGE; |
64 break; | 67 break; |
65 case VIEW_TYPE_PANEL: | 68 case VIEW_TYPE_PANEL: |
66 view->type = api::developer_private::VIEW_TYPE_PANEL; | 69 view->type = api::developer_private::VIEW_TYPE_PANEL; |
67 break; | 70 break; |
68 case VIEW_TYPE_TAB_CONTENTS: | 71 case VIEW_TYPE_TAB_CONTENTS: |
69 view->type = api::developer_private::VIEW_TYPE_TAB_CONTENTS; | 72 view->type = api::developer_private::VIEW_TYPE_TAB_CONTENTS; |
70 break; | 73 break; |
71 case VIEW_TYPE_VIRTUAL_KEYBOARD: | 74 case VIEW_TYPE_VIRTUAL_KEYBOARD: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ProcessManager* process_manager, | 131 ProcessManager* process_manager, |
129 bool is_incognito, | 132 bool is_incognito, |
130 ViewList* result) { | 133 ViewList* result) { |
131 const std::set<content::RenderFrameHost*>& hosts = | 134 const std::set<content::RenderFrameHost*>& hosts = |
132 process_manager->GetRenderFrameHostsForExtension(extension.id()); | 135 process_manager->GetRenderFrameHostsForExtension(extension.id()); |
133 for (content::RenderFrameHost* host : hosts) { | 136 for (content::RenderFrameHost* host : hosts) { |
134 content::WebContents* web_contents = | 137 content::WebContents* web_contents = |
135 content::WebContents::FromRenderFrameHost(host); | 138 content::WebContents::FromRenderFrameHost(host); |
136 ViewType host_type = GetViewType(web_contents); | 139 ViewType host_type = GetViewType(web_contents); |
137 if (host_type == VIEW_TYPE_EXTENSION_POPUP || | 140 if (host_type == VIEW_TYPE_EXTENSION_POPUP || |
138 host_type == VIEW_TYPE_EXTENSION_DIALOG) { | 141 host_type == VIEW_TYPE_EXTENSION_DIALOG || |
| 142 host_type == VIEW_TYPE_EXTENSION_SIDEBAR) { |
139 continue; | 143 continue; |
140 } | 144 } |
141 | 145 |
142 GURL url = web_contents->GetURL(); | 146 GURL url = web_contents->GetURL(); |
143 // If this is a background page that just opened, there might not be a | 147 // If this is a background page that just opened, there might not be a |
144 // committed (or visible) url yet. In this case, use the initial url. | 148 // committed (or visible) url yet. In this case, use the initial url. |
145 if (url.is_empty()) { | 149 if (url.is_empty()) { |
146 ExtensionHost* extension_host = | 150 ExtensionHost* extension_host = |
147 process_manager->GetExtensionHostForRenderFrameHost(host); | 151 process_manager->GetExtensionHostForRenderFrameHost(host); |
148 if (extension_host) | 152 if (extension_host) |
(...skipping 26 matching lines...) Expand all Loading... |
175 url = window->initial_url(); | 179 url = window->initial_url(); |
176 | 180 |
177 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); | 181 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); |
178 result->push_back(ConstructView( | 182 result->push_back(ConstructView( |
179 url, process->GetID(), web_contents->GetMainFrame()->GetRoutingID(), | 183 url, process->GetID(), web_contents->GetMainFrame()->GetRoutingID(), |
180 false, GetViewType(web_contents))); | 184 false, GetViewType(web_contents))); |
181 } | 185 } |
182 } | 186 } |
183 | 187 |
184 } // namespace extensions | 188 } // namespace extensions |
OLD | NEW |