blob: d3f38a7bb2a0af718a5d266f3710470583cd7daa [file] [log] [blame]
// 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"
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()->UpdatePageActionIcon(PageActionIconType::kIntentPicker);
}
IntentPickerTabHelper::IntentPickerTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {}
WEB_CONTENTS_USER_DATA_KEY_IMPL(IntentPickerTabHelper)