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

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

Issue 2973313002: Chrome Cleanup: re-open settings post-cleanup if reboot is needed (Closed)
Patch Set: Revert changes to md_settings_ui.cc (to do in another CL) 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
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.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_already_open) {
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_already_open && web_contents &&
41 web_contents->GetLastCommittedURL() == chrome::kChromeUISettingsURL) {
42 browser->window()->Show();
csharp 2017/07/10 20:53:26 If the settings tab is already the current tab, wh
proberge 2017/07/10 21:16:03 If the window is in the background (ex. a differen
43 return;
44 }
45
46 browser->OpenURL(content::OpenURLParams(
47 GURL(chrome::kChromeUISettingsURL), content::Referrer(), disposition,
48 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, /*is_renderer_initiated=*/false));
49 }
50
51 } // namespace chrome_cleaner_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698