| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "chrome/browser/ui/intent_picker_tab_helper.h" |
| |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/page_action/page_action_icon_container.h" |
| |
| IntentPickerTabHelper::~IntentPickerTabHelper() = default; |
| |
| // static |
| void IntentPickerTabHelper::SetShouldShowIcon( |
| content::WebContents* web_contents, |
| bool should_show_icon) { |
| IntentPickerTabHelper* tab_helper = FromWebContents(web_contents); |
| if (!tab_helper) |
| return; |
| tab_helper->should_show_icon_ = should_show_icon; |
| Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| if (!browser) |
| return; |
| browser->window()->GetOmniboxPageActionIconContainer()->UpdatePageActionIcon( |
| PageActionIconType::kIntentPicker); |
| } |
| |
| IntentPickerTabHelper::IntentPickerTabHelper(content::WebContents* web_contents) |
| : content::WebContentsObserver(web_contents) {} |
| |
| WEB_CONTENTS_USER_DATA_KEY_IMPL(IntentPickerTabHelper) |