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

Side by Side Diff: chrome/browser/ui/webui/set_as_default_browser_ui.cc

Issue 10696093: Hide the main window when Set-As-Default dialog is present. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a crash planted in the previous patch. Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webui/set_as_default_browser_ui.h" 5 #include "chrome/browser/ui/webui/set_as_default_browser_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/shell_integration.h" 13 #include "chrome/browser/shell_integration.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_dialogs.h" 15 #include "chrome/browser/ui/browser_dialogs.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/chrome_pages.h" 20 #include "chrome/browser/ui/chrome_pages.h"
20 #include "chrome/browser/ui/singleton_tabs.h" 21 #include "chrome/browser/ui/singleton_tabs.h"
21 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 22 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
22 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 23 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
25 #include "chrome/installer/util/install_util.h" 26 #include "chrome/installer/util/install_util.h"
26 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
27 #include "content/public/browser/web_contents_delegate.h" 28 #include "content/public/browser/web_contents_delegate.h"
29 #include "content/public/browser/web_contents_view.h"
28 #include "content/public/browser/web_ui.h" 30 #include "content/public/browser/web_ui.h"
29 #include "content/public/browser/web_ui_message_handler.h" 31 #include "content/public/browser/web_ui_message_handler.h"
30 #include "grit/browser_resources.h" 32 #include "grit/browser_resources.h"
31 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
32 #include "grit/locale_settings.h" 34 #include "grit/locale_settings.h"
33 #include "ui/base/l10n/l10n_font_util.h" 35 #include "ui/base/l10n/l10n_font_util.h"
34 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/gfx/font.h" 37 #include "ui/gfx/font.h"
36 #include "ui/web_dialogs/web_dialog_delegate.h" 38 #include "ui/web_dialogs/web_dialog_delegate.h"
37 39
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void SetAsDefaultBrowserHandler::ConcludeInteraction() { 167 void SetAsDefaultBrowserHandler::ConcludeInteraction() {
166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
167 WebContents* contents = web_ui()->GetWebContents(); 169 WebContents* contents = web_ui()->GetWebContents();
168 if (contents) { 170 if (contents) {
169 content::WebContentsDelegate* delegate = contents->GetDelegate(); 171 content::WebContentsDelegate* delegate = contents->GetDelegate();
170 if (delegate) { 172 if (delegate) {
171 if (!delegate->IsPopupOrPanel(contents)) { 173 if (!delegate->IsPopupOrPanel(contents)) {
172 Browser* browser = browser::FindBrowserWithWebContents(contents); 174 Browser* browser = browser::FindBrowserWithWebContents(contents);
173 if (browser) 175 if (browser)
174 chrome::ShowSyncSetup(browser, SyncPromoUI::SOURCE_START_PAGE); 176 chrome::ShowSyncSetup(browser, SyncPromoUI::SOURCE_START_PAGE);
177 } else {
178 // For the purpose of showihng this dialog showing browsers was
179 // supressed. Now we have to get them shown.
180 for (BrowserList::const_iterator it = BrowserList::begin();
181 it != BrowserList::end(); ++it) {
cpu_(ooo_6.6-7.5) 2012/07/06 23:30:47 iterating over the browsers... Please ask jam@ if
jam 2012/07/12 18:38:40 that's fine. once we have different contexts for m
motek. 2012/08/08 14:28:35 Done.
motek. 2012/08/08 14:28:35 Thank for for the comment. Keeping the iteration.
182 BrowserWindow* window = NULL;
183 WebContents* other_contents = chrome::GetActiveWebContents(*it);
184 window = (*it)->window();
185 if (window && other_contents && other_contents != contents) {
186 window->Show();
187 other_contents->GetView()->SetInitialFocus();
188 }
189 }
175 } 190 }
176 delegate->CloseContents(contents); 191 delegate->CloseContents(contents);
177 } 192 }
178 } 193 }
179 } 194 }
180 195
181 void SetAsDefaultBrowserHandler::ActivateMetroChrome() { 196 void SetAsDefaultBrowserHandler::ActivateMetroChrome() {
182 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
183 198
184 FilePath cur_chrome_exe; 199 FilePath cur_chrome_exe;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 new SetAsDefaultBrowserDialogImpl(profile, browser); 337 new SetAsDefaultBrowserDialogImpl(profile, browser);
323 dialog->ShowDialog(); 338 dialog->ShowDialog();
324 } else { 339 } else {
325 GURL url(chrome::kChromeUIMetroFlowURL); 340 GURL url(chrome::kChromeUIMetroFlowURL);
326 chrome::NavigateParams params( 341 chrome::NavigateParams params(
327 chrome::GetSingletonTabNavigateParams(browser, url)); 342 chrome::GetSingletonTabNavigateParams(browser, url));
328 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; 343 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
329 chrome::ShowSingletonTabOverwritingNTP(browser, params); 344 chrome::ShowSingletonTabOverwritingNTP(browser, params);
330 } 345 }
331 } 346 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698