Commit af77a2d0 authored by dvh@chromium.org's avatar dvh@chromium.org

Fixed case where _generated_background_page.html was still showing.

Make sure to compute generated_background_page value in all cases.

BUG=276519

Review URL: https://chromiumcodereview.appspot.com/23535002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220486 0039d316-1c4b-4281-b951-d872f2087c98
parent 7f2d6209
......@@ -342,8 +342,11 @@ scoped_ptr<developer::ItemInfo>
void DeveloperPrivateGetItemsInfoFunction::
GetInspectablePagesForExtensionProcess(
const Extension* extension,
const std::set<content::RenderViewHost*>& views,
ItemInspectViewList* result) {
bool has_generated_background_page =
BackgroundInfo::HasGeneratedBackgroundPage(extension);
for (std::set<content::RenderViewHost*>::const_iterator iter = views.begin();
iter != views.end(); ++iter) {
content::RenderViewHost* host = *iter;
......@@ -355,12 +358,14 @@ void DeveloperPrivateGetItemsInfoFunction::
continue;
content::RenderProcessHost* process = host->GetProcess();
result->push_back(
constructInspectView(web_contents->GetURL(),
process->GetID(),
host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(),
false));
bool is_background_page =
(web_contents->GetURL() == BackgroundInfo::GetBackgroundURL(extension));
result->push_back(constructInspectView(
web_contents->GetURL(),
process->GetID(),
host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(),
is_background_page && has_generated_background_page));
}
}
......@@ -374,17 +379,21 @@ void DeveloperPrivateGetItemsInfoFunction::
const ShellWindowRegistry::ShellWindowList windows =
registry->GetShellWindowsForApp(extension->id());
bool has_generated_background_page =
BackgroundInfo::HasGeneratedBackgroundPage(extension);
for (ShellWindowRegistry::const_iterator it = windows.begin();
it != windows.end(); ++it) {
content::WebContents* web_contents = (*it)->web_contents();
RenderViewHost* host = web_contents->GetRenderViewHost();
content::RenderProcessHost* process = host->GetProcess();
result->push_back(
constructInspectView(web_contents->GetURL(),
process->GetID(),
host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(),
false));
bool is_background_page =
(web_contents->GetURL() == BackgroundInfo::GetBackgroundURL(extension));
result->push_back(constructInspectView(
web_contents->GetURL(),
process->GetID(),
host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(),
is_background_page && has_generated_background_page));
}
}
......@@ -422,6 +431,7 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction::
ExtensionProcessManager* process_manager =
ExtensionSystem::Get(profile())->process_manager();
GetInspectablePagesForExtensionProcess(
extension,
process_manager->GetRenderViewHostsForExtension(extension->id()),
&result);
......@@ -448,6 +458,7 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction::
process_manager = ExtensionSystem::Get(
service->profile()->GetOffTheRecordProfile())->process_manager();
GetInspectablePagesForExtensionProcess(
extension,
process_manager->GetRenderViewHostsForExtension(extension->id()),
&result);
......
......@@ -151,6 +151,7 @@ class DeveloperPrivateGetItemsInfoFunction : public AsyncExtensionFunction {
// Helper that lists the current inspectable html pages for the extension.
void GetInspectablePagesForExtensionProcess(
const Extension* extension,
const std::set<content::RenderViewHost*>& views,
ItemInspectViewList* result);
......
......@@ -1005,6 +1005,7 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension(
ExtensionProcessManager* process_manager =
ExtensionSystem::Get(extension_service_->profile())->process_manager();
GetInspectablePagesForExtensionProcess(
extension,
process_manager->GetRenderViewHostsForExtension(extension->id()),
&result);
......@@ -1032,6 +1033,7 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension(
ExtensionSystem::Get(extension_service_->profile()->
GetOffTheRecordProfile())->process_manager();
GetInspectablePagesForExtensionProcess(
extension,
process_manager->GetRenderViewHostsForExtension(extension->id()),
&result);
......@@ -1051,8 +1053,11 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension(
}
void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess(
const Extension* extension,
const std::set<RenderViewHost*>& views,
std::vector<ExtensionPage>* result) {
bool has_generated_background_page =
BackgroundInfo::HasGeneratedBackgroundPage(extension);
for (std::set<RenderViewHost*>::const_iterator iter = views.begin();
iter != views.end(); ++iter) {
RenderViewHost* host = *iter;
......@@ -1065,9 +1070,14 @@ void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess(
GURL url = web_contents->GetURL();
content::RenderProcessHost* process = host->GetProcess();
bool is_background_page =
(url == BackgroundInfo::GetBackgroundURL(extension));
result->push_back(
ExtensionPage(url, process->GetID(), host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(), false));
ExtensionPage(url,
process->GetID(),
host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(),
is_background_page && has_generated_background_page));
}
}
......@@ -1081,16 +1091,22 @@ void ExtensionSettingsHandler::GetShellWindowPagesForExtensionProfile(
const apps::ShellWindowRegistry::ShellWindowList windows =
registry->GetShellWindowsForApp(extension->id());
bool has_generated_background_page =
BackgroundInfo::HasGeneratedBackgroundPage(extension);
for (apps::ShellWindowRegistry::const_iterator it = windows.begin();
it != windows.end(); ++it) {
WebContents* web_contents = (*it)->web_contents();
RenderViewHost* host = web_contents->GetRenderViewHost();
content::RenderProcessHost* process = host->GetProcess();
bool is_background_page =
(web_contents->GetURL() == BackgroundInfo::GetBackgroundURL(extension));
result->push_back(
ExtensionPage(web_contents->GetURL(), process->GetID(),
ExtensionPage(web_contents->GetURL(),
process->GetID(),
host->GetRoutingID(),
process->GetBrowserContext()->IsOffTheRecord(), false));
process->GetBrowserContext()->IsOffTheRecord(),
is_background_page && has_generated_background_page));
}
}
......
......@@ -193,6 +193,7 @@ class ExtensionSettingsHandler
std::vector<ExtensionPage> GetInspectablePagesForExtension(
const Extension* extension, bool extension_is_enabled);
void GetInspectablePagesForExtensionProcess(
const Extension* extension,
const std::set<content::RenderViewHost*>& views,
std::vector<ExtensionPage>* result);
void GetShellWindowPagesForExtensionProfile(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment