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

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents_wrapper.cc

Issue 7601013: Web Intents: Hook up the register intent InfoBar with the WebIntentsRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanups and fixes. Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/tab_contents/tab_contents_wrapper.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/browser/autocomplete_history_manager.h" 9 #include "chrome/browser/autocomplete_history_manager.h"
10 #include "chrome/browser/autofill/autofill_manager.h" 10 #include "chrome/browser/autofill/autofill_manager.h"
11 #include "chrome/browser/automation/automation_tab_helper.h" 11 #include "chrome/browser/automation/automation_tab_helper.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/browser_shutdown.h" 13 #include "chrome/browser/browser_shutdown.h"
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
15 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 15 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
16 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 16 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
17 #include "chrome/browser/extensions/extension_tab_helper.h" 17 #include "chrome/browser/extensions/extension_tab_helper.h"
18 #include "chrome/browser/extensions/extension_webnavigation_api.h" 18 #include "chrome/browser/extensions/extension_webnavigation_api.h"
19 #include "chrome/browser/external_protocol/external_protocol_observer.h" 19 #include "chrome/browser/external_protocol/external_protocol_observer.h"
20 #include "chrome/browser/favicon/favicon_tab_helper.h" 20 #include "chrome/browser/favicon/favicon_tab_helper.h"
21 #include "chrome/browser/file_select_helper.h" 21 #include "chrome/browser/file_select_helper.h"
22 #include "chrome/browser/google/google_util.h" 22 #include "chrome/browser/google/google_util.h"
23 #include "chrome/browser/history/history_tab_helper.h" 23 #include "chrome/browser/history/history_tab_helper.h"
24 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" 24 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
25 #include "chrome/browser/intents/web_intent_data.h"
25 #include "chrome/browser/omnibox_search_hint.h" 26 #include "chrome/browser/omnibox_search_hint.h"
26 #include "chrome/browser/password_manager/password_manager.h" 27 #include "chrome/browser/password_manager/password_manager.h"
27 #include "chrome/browser/password_manager_delegate_impl.h" 28 #include "chrome/browser/password_manager_delegate_impl.h"
28 #include "chrome/browser/pdf_unsupported_feature.h" 29 #include "chrome/browser/pdf_unsupported_feature.h"
29 #include "chrome/browser/plugin_observer.h" 30 #include "chrome/browser/plugin_observer.h"
30 #include "chrome/browser/prefs/pref_service.h" 31 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/prerender/prerender_observer.h" 32 #include "chrome/browser/prerender/prerender_observer.h"
32 #include "chrome/browser/printing/print_preview_message_handler.h" 33 #include "chrome/browser/printing/print_preview_message_handler.h"
33 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/remoting/firewall_traversal_tab_helper.h" 35 #include "chrome/browser/remoting/firewall_traversal_tab_helper.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 void TabContentsWrapper::OnRegisterIntentHandler(const string16& action, 591 void TabContentsWrapper::OnRegisterIntentHandler(const string16& action,
591 const string16& type, 592 const string16& type,
592 const string16& href, 593 const string16& href,
593 const string16& title) { 594 const string16& title) {
594 if (profile()->IsOffTheRecord()) 595 if (profile()->IsOffTheRecord())
595 return; 596 return;
596 597
597 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) 598 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents))
598 return; 599 return;
599 600
600 AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(tab_contents())); 601 WebIntentData intent;
602 intent.service_url = GURL(href);
603 intent.action = action;
604 intent.type = type;
605 AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(tab_contents(), intent));
601 } 606 }
602 607
603 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { 608 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) {
604 NotificationService::current()->Notify( 609 NotificationService::current()->Notify(
605 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, 610 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
606 Source<TabContentsWrapper>(this), 611 Source<TabContentsWrapper>(this),
607 Details<const SkBitmap>(&bitmap)); 612 Details<const SkBitmap>(&bitmap));
608 } 613 }
609 614
610 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { 615 void TabContentsWrapper::OnPDFHasUnsupportedFeature() {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 if (infobars_.empty()) { 719 if (infobars_.empty()) {
715 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 720 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
716 Source<NavigationController>(&tab_contents_->controller())); 721 Source<NavigationController>(&tab_contents_->controller()));
717 } 722 }
718 } 723 }
719 724
720 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { 725 void TabContentsWrapper::RemoveAllInfoBars(bool animate) {
721 while (!infobars_.empty()) 726 while (!infobars_.empty())
722 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); 727 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate);
723 } 728 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698