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

Side by Side Diff: chrome/browser/browser_init.cc

Issue 2847090: Fix --kiosk to work regardless of the startup pref setting or supplied URLs. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/browser_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser_init.h" 5 #include "chrome/browser/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 } 545 }
546 #if defined(OS_MACOSX) 546 #if defined(OS_MACOSX)
547 // Check whether the auto-update system needs to be promoted from user 547 // Check whether the auto-update system needs to be promoted from user
548 // to system. 548 // to system.
549 KeystoneInfoBar::PromotionInfoBar(profile); 549 KeystoneInfoBar::PromotionInfoBar(profile);
550 #endif 550 #endif
551 } 551 }
552 } else { 552 } else {
553 RecordLaunchModeHistogram(LM_AS_WEBAPP); 553 RecordLaunchModeHistogram(LM_AS_WEBAPP);
554 } 554 }
555 // After this point, BrowserList::GetLastActive() should be non-NULL on all
556 // platforms until there are no more Browsers.
557
558 #if !defined(OS_MACOSX)
559 // In kiosk mode, we want to always be fullscreen, so switch to that now.
560 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
561 BrowserList::GetLastActive()->ToggleFullscreenMode();
562 #endif
555 563
556 #if defined(OS_WIN) 564 #if defined(OS_WIN)
557 // Print the selected page if the command line switch exists. Note that the 565 // Print the selected page if the command line switch exists. Note that the
558 // current selected tab would be the page which will be printed. 566 // current selected tab would be the page which will be printed.
559 if (command_line_.HasSwitch(switches::kPrint)) { 567 if (command_line_.HasSwitch(switches::kPrint))
560 Browser* browser = BrowserList::GetLastActive(); 568 BrowserList::GetLastActive()->Print();
561 browser->Print();
562 }
563 #endif 569 #endif
564 570
565 // If we're recording or playing back, startup the EventRecorder now 571 // If we're recording or playing back, startup the EventRecorder now
566 // unless otherwise specified. 572 // unless otherwise specified.
567 if (!command_line_.HasSwitch(switches::kNoEvents)) { 573 if (!command_line_.HasSwitch(switches::kNoEvents)) {
568 FilePath script_path; 574 FilePath script_path;
569 PathService::Get(chrome::FILE_RECORDED_SCRIPT, &script_path); 575 PathService::Get(chrome::FILE_RECORDED_SCRIPT, &script_path);
570 576
571 bool record_mode = command_line_.HasSwitch(switches::kRecordMode); 577 bool record_mode = command_line_.HasSwitch(switches::kRecordMode);
572 bool playback_mode = command_line_.HasSwitch(switches::kPlaybackMode); 578 bool playback_mode = command_line_.HasSwitch(switches::kPlaybackMode);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 browser = Browser::Create(profile_); 742 browser = Browser::Create(profile_);
737 } else { 743 } else {
738 #if defined(TOOLKIT_GTK) 744 #if defined(TOOLKIT_GTK)
739 // Setting the time of the last action on the window here allows us to steal 745 // Setting the time of the last action on the window here allows us to steal
740 // focus, which is what the user wants when opening a new tab in an existing 746 // focus, which is what the user wants when opening a new tab in an existing
741 // browser window. 747 // browser window.
742 gtk_util::SetWMLastUserActionTime(browser->window()->GetNativeHandle()); 748 gtk_util::SetWMLastUserActionTime(browser->window()->GetNativeHandle());
743 #endif 749 #endif
744 } 750 }
745 751
746 #if !defined(OS_MACOSX)
747 // In kiosk mode, we want to always be fullscreen, so switch to that now.
748 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
749 browser->ToggleFullscreenMode();
750 #endif
751
752 bool first_tab = true; 752 bool first_tab = true;
753 for (size_t i = 0; i < tabs.size(); ++i) { 753 for (size_t i = 0; i < tabs.size(); ++i) {
754 // We skip URLs that we'd have to launch an external protocol handler for. 754 // We skip URLs that we'd have to launch an external protocol handler for.
755 // This avoids us getting into an infinite loop asking ourselves to open 755 // This avoids us getting into an infinite loop asking ourselves to open
756 // a URL, should the handler be (incorrectly) configured to be us. Anyone 756 // a URL, should the handler be (incorrectly) configured to be us. Anyone
757 // asking us to open such a URL should really ask the handler directly. 757 // asking us to open such a URL should really ask the handler directly.
758 if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url)) 758 if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url))
759 continue; 759 continue;
760 760
761 int add_types = first_tab ? TabStripModel::ADD_SELECTED : 761 int add_types = first_tab ? TabStripModel::ADD_SELECTED :
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 scoped_refptr<AutomationProviderClass> automation = 1053 scoped_refptr<AutomationProviderClass> automation =
1054 new AutomationProviderClass(profile); 1054 new AutomationProviderClass(profile);
1055 automation->ConnectToChannel(channel_id); 1055 automation->ConnectToChannel(channel_id);
1056 automation->SetExpectedTabCount(expected_tabs); 1056 automation->SetExpectedTabCount(expected_tabs);
1057 1057
1058 AutomationProviderList* list = 1058 AutomationProviderList* list =
1059 g_browser_process->InitAutomationProviderList(); 1059 g_browser_process->InitAutomationProviderList();
1060 DCHECK(list); 1060 DCHECK(list);
1061 list->AddProvider(automation); 1061 list->AddProvider(automation);
1062 } 1062 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698