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

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_navigation_util_win.cc

Issue 2973313002: Chrome Cleanup: re-open settings post-cleanup if reboot is needed (Closed)
Patch Set: navigation_util -> navigation_util_win since not used on other platforms Created 3 years, 5 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 | « chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_navigation_util_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_navigation_ util_win.h"
6
7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/browser/ui/browser_window.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/common/url_constants.h"
11 #include "ui/base/page_transition_types.h"
12 #include "ui/base/window_open_disposition.h"
13 #include "url/gurl.h"
14
15 namespace chrome_cleaner_util {
16
17 Browser* FindBrowser() {
18 BrowserList* browser_list = BrowserList::GetInstance();
19 for (BrowserList::const_reverse_iterator browser_iterator =
20 browser_list->begin_last_active();
21 browser_iterator != browser_list->end_last_active();
22 ++browser_iterator) {
23 Browser* browser = *browser_iterator;
24 if (browser->is_type_tabbed() &&
25 (browser->window()->IsActive() || !browser->window()->IsMinimized()))
26 return browser;
27 }
28
29 return nullptr;
30 }
31
32 void OpenSettingsPage(Browser* browser,
33 WindowOpenDisposition disposition,
34 bool skip_if_current_tab) {
35 DCHECK(browser);
36
37 // Skip opening the settings page if it's already the currently active tab.
38 content::WebContents* web_contents =
39 browser->tab_strip_model()->GetActiveWebContents();
40 if (skip_if_current_tab && web_contents &&
41 web_contents->GetLastCommittedURL() == chrome::kChromeUISettingsURL) {
42 return;
43 }
44
45 browser->OpenURL(content::OpenURLParams(
46 GURL(chrome::kChromeUISettingsURL), content::Referrer(), disposition,
47 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, /*is_renderer_initiated=*/false));
48 }
49
50 } // namespace chrome_cleaner_util
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_navigation_util_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698