| 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 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 InspectableViewsFinder::View InspectableViewsFinder::ConstructView( | 34 InspectableViewsFinder::View InspectableViewsFinder::ConstructView( |
| 35 const GURL& url, | 35 const GURL& url, |
| 36 int render_process_id, | 36 int render_process_id, |
| 37 int render_frame_id, | 37 int render_frame_id, |
| 38 bool incognito, | 38 bool incognito, |
| 39 bool is_iframe, | 39 bool is_iframe, |
| 40 ViewType type) { | 40 ViewType type) { |
| 41 linked_ptr<api::developer_private::ExtensionView> view( | 41 api::developer_private::ExtensionView view; |
| 42 new api::developer_private::ExtensionView()); | 42 view.url = url.spec(); |
| 43 view->url = url.spec(); | 43 view.render_process_id = render_process_id; |
| 44 view->render_process_id = render_process_id; | |
| 45 // NOTE(devlin): This is called "render_view_id" in the api for legacy | 44 // NOTE(devlin): This is called "render_view_id" in the api for legacy |
| 46 // reasons, but it's not a high priority to change. | 45 // reasons, but it's not a high priority to change. |
| 47 view->render_view_id = render_frame_id; | 46 view.render_view_id = render_frame_id; |
| 48 view->incognito = incognito; | 47 view.incognito = incognito; |
| 49 view->is_iframe = is_iframe; | 48 view.is_iframe = is_iframe; |
| 50 switch (type) { | 49 switch (type) { |
| 51 case VIEW_TYPE_APP_WINDOW: | 50 case VIEW_TYPE_APP_WINDOW: |
| 52 view->type = api::developer_private::VIEW_TYPE_APP_WINDOW; | 51 view.type = api::developer_private::VIEW_TYPE_APP_WINDOW; |
| 53 break; | 52 break; |
| 54 case VIEW_TYPE_BACKGROUND_CONTENTS: | 53 case VIEW_TYPE_BACKGROUND_CONTENTS: |
| 55 view->type = api::developer_private::VIEW_TYPE_BACKGROUND_CONTENTS; | 54 view.type = api::developer_private::VIEW_TYPE_BACKGROUND_CONTENTS; |
| 56 break; | 55 break; |
| 57 case VIEW_TYPE_COMPONENT: | 56 case VIEW_TYPE_COMPONENT: |
| 58 view->type = api::developer_private::VIEW_TYPE_COMPONENT; | 57 view.type = api::developer_private::VIEW_TYPE_COMPONENT; |
| 59 break; | 58 break; |
| 60 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: | 59 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: |
| 61 view->type = api::developer_private::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 60 view.type = api::developer_private::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
| 62 break; | 61 break; |
| 63 case VIEW_TYPE_EXTENSION_DIALOG: | 62 case VIEW_TYPE_EXTENSION_DIALOG: |
| 64 view->type = api::developer_private::VIEW_TYPE_EXTENSION_DIALOG; | 63 view.type = api::developer_private::VIEW_TYPE_EXTENSION_DIALOG; |
| 65 break; | 64 break; |
| 66 case VIEW_TYPE_EXTENSION_GUEST: | 65 case VIEW_TYPE_EXTENSION_GUEST: |
| 67 view->type = api::developer_private::VIEW_TYPE_EXTENSION_GUEST; | 66 view.type = api::developer_private::VIEW_TYPE_EXTENSION_GUEST; |
| 68 break; | 67 break; |
| 69 case VIEW_TYPE_EXTENSION_POPUP: | 68 case VIEW_TYPE_EXTENSION_POPUP: |
| 70 view->type = api::developer_private::VIEW_TYPE_EXTENSION_POPUP; | 69 view.type = api::developer_private::VIEW_TYPE_EXTENSION_POPUP; |
| 71 break; | 70 break; |
| 72 case VIEW_TYPE_LAUNCHER_PAGE: | 71 case VIEW_TYPE_LAUNCHER_PAGE: |
| 73 view->type = api::developer_private::VIEW_TYPE_LAUNCHER_PAGE; | 72 view.type = api::developer_private::VIEW_TYPE_LAUNCHER_PAGE; |
| 74 break; | 73 break; |
| 75 case VIEW_TYPE_PANEL: | 74 case VIEW_TYPE_PANEL: |
| 76 view->type = api::developer_private::VIEW_TYPE_PANEL; | 75 view.type = api::developer_private::VIEW_TYPE_PANEL; |
| 77 break; | 76 break; |
| 78 case VIEW_TYPE_TAB_CONTENTS: | 77 case VIEW_TYPE_TAB_CONTENTS: |
| 79 view->type = api::developer_private::VIEW_TYPE_TAB_CONTENTS; | 78 view.type = api::developer_private::VIEW_TYPE_TAB_CONTENTS; |
| 80 break; | 79 break; |
| 81 default: | 80 default: |
| 82 NOTREACHED(); | 81 NOTREACHED(); |
| 83 } | 82 } |
| 84 return view; | 83 return view; |
| 85 } | 84 } |
| 86 | 85 |
| 87 InspectableViewsFinder::ViewList InspectableViewsFinder::GetViewsForExtension( | 86 InspectableViewsFinder::ViewList InspectableViewsFinder::GetViewsForExtension( |
| 88 const Extension& extension, | 87 const Extension& extension, |
| 89 bool is_enabled) { | 88 bool is_enabled) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 url = window->initial_url(); | 194 url = window->initial_url(); |
| 196 | 195 |
| 197 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); | 196 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); |
| 198 result->push_back(ConstructView( | 197 result->push_back(ConstructView( |
| 199 url, process->GetID(), web_contents->GetMainFrame()->GetRoutingID(), | 198 url, process->GetID(), web_contents->GetMainFrame()->GetRoutingID(), |
| 200 false, false, GetViewType(web_contents))); | 199 false, false, GetViewType(web_contents))); |
| 201 } | 200 } |
| 202 } | 201 } |
| 203 | 202 |
| 204 } // namespace extensions | 203 } // namespace extensions |
| OLD | NEW |