Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: extensions/browser/extension_host.cc

Issue 923463003: [Extensions] Remove the Infobar API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/extension_host.h ('k') | extensions/browser/process_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "extensions/browser/extension_host.h" 5 #include "extensions/browser/extension_host.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 browser_context_(site_instance->GetBrowserContext()), 123 browser_context_(site_instance->GetBrowserContext()),
124 render_view_host_(NULL), 124 render_view_host_(NULL),
125 did_stop_loading_(false), 125 did_stop_loading_(false),
126 document_element_available_(false), 126 document_element_available_(false),
127 initial_url_(url), 127 initial_url_(url),
128 extension_function_dispatcher_(browser_context_, this), 128 extension_function_dispatcher_(browser_context_, this),
129 extension_host_type_(host_type) { 129 extension_host_type_(host_type) {
130 // Not used for panels, see PanelHost. 130 // Not used for panels, see PanelHost.
131 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || 131 DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE ||
132 host_type == VIEW_TYPE_EXTENSION_DIALOG || 132 host_type == VIEW_TYPE_EXTENSION_DIALOG ||
133 host_type == VIEW_TYPE_EXTENSION_INFOBAR ||
134 host_type == VIEW_TYPE_EXTENSION_POPUP); 133 host_type == VIEW_TYPE_EXTENSION_POPUP);
135 host_contents_.reset(WebContents::Create( 134 host_contents_.reset(WebContents::Create(
136 WebContents::CreateParams(browser_context_, site_instance))), 135 WebContents::CreateParams(browser_context_, site_instance))),
137 content::WebContentsObserver::Observe(host_contents_.get()); 136 content::WebContentsObserver::Observe(host_contents_.get());
138 host_contents_->SetDelegate(this); 137 host_contents_->SetDelegate(this);
139 SetViewType(host_contents_.get(), host_type); 138 SetViewType(host_contents_.get(), host_type);
140 139
141 render_view_host_ = host_contents_->GetRenderViewHost(); 140 render_view_host_ = host_contents_->GetRenderViewHost();
142 141
143 // Listen for when an extension is unloaded from the same profile, as it may 142 // Listen for when an extension is unloaded from the same profile, as it may
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 DCHECK(extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); 338 DCHECK(extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
340 // Nothing to do for background pages. 339 // Nothing to do for background pages.
341 } 340 }
342 341
343 void ExtensionHost::DocumentAvailableInMainFrame() { 342 void ExtensionHost::DocumentAvailableInMainFrame() {
344 // If the document has already been marked as available for this host, then 343 // If the document has already been marked as available for this host, then
345 // bail. No need for the redundant setup. http://crbug.com/31170 344 // bail. No need for the redundant setup. http://crbug.com/31170
346 if (document_element_available_) 345 if (document_element_available_)
347 return; 346 return;
348 document_element_available_ = true; 347 document_element_available_ = true;
349 OnDocumentAvailable();
350 }
351 348
352 void ExtensionHost::OnDocumentAvailable() { 349 if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
353 DCHECK(extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); 350 ExtensionSystem::Get(browser_context_)
354 ExtensionSystem::Get(browser_context_) 351 ->runtime_data()
355 ->runtime_data() 352 ->SetBackgroundPageReady(extension_->id(), true);
356 ->SetBackgroundPageReady(extension_->id(), true); 353 content::NotificationService::current()->Notify(
357 content::NotificationService::current()->Notify( 354 extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
358 extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, 355 content::Source<const Extension>(extension_),
359 content::Source<const Extension>(extension_), 356 content::NotificationService::NoDetails());
360 content::NotificationService::NoDetails()); 357 }
361 } 358 }
362 359
363 void ExtensionHost::CloseContents(WebContents* contents) { 360 void ExtensionHost::CloseContents(WebContents* contents) {
364 Close(); 361 Close();
365 } 362 }
366 363
367 bool ExtensionHost::OnMessageReceived(const IPC::Message& message) { 364 bool ExtensionHost::OnMessageReceived(const IPC::Message& message) {
368 bool handled = true; 365 bool handled = true;
369 IPC_BEGIN_MESSAGE_MAP(ExtensionHost, message) 366 IPC_BEGIN_MESSAGE_MAP(ExtensionHost, message)
370 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 367 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 return delegate_->CheckMediaAccessPermission( 484 return delegate_->CheckMediaAccessPermission(
488 web_contents, security_origin, type, extension()); 485 web_contents, security_origin, type, extension());
489 } 486 }
490 487
491 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { 488 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) {
492 ViewType view_type = extensions::GetViewType(web_contents); 489 ViewType view_type = extensions::GetViewType(web_contents);
493 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; 490 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE;
494 } 491 }
495 492
496 } // namespace extensions 493 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_host.h ('k') | extensions/browser/process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698