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

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

Issue 3061026: 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 | 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
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 #if defined(OS_MACOSX) 545 #if defined(OS_MACOSX)
546 // Check whether the auto-update system needs to be promoted from user 546 // Check whether the auto-update system needs to be promoted from user
547 // to system. 547 // to system.
548 KeystoneInfoBar::PromotionInfoBar(profile); 548 KeystoneInfoBar::PromotionInfoBar(profile);
549 #endif 549 #endif
550 } 550 }
551 } else { 551 } else {
552 RecordLaunchModeHistogram(LM_AS_WEBAPP); 552 RecordLaunchModeHistogram(LM_AS_WEBAPP);
553 } 553 }
554 554
555 #if !defined(OS_MACOSX)
556 // In kiosk mode, we want to always be fullscreen, so switch to that now.
557 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
558 BrowserList::GetLastActive()->ToggleFullscreenMode();
559 #endif
560
555 #if defined(OS_WIN) 561 #if defined(OS_WIN)
556 // Print the selected page if the command line switch exists. Note that the 562 // Print the selected page if the command line switch exists. Note that the
557 // current selected tab would be the page which will be printed. 563 // current selected tab would be the page which will be printed.
558 if (command_line_.HasSwitch(switches::kPrint)) { 564 if (command_line_.HasSwitch(switches::kPrint))
559 Browser* browser = BrowserList::GetLastActive(); 565 BrowserList::GetLastActive()->Print();
560 browser->Print();
561 }
562 #endif 566 #endif
563 567
564 // If we're recording or playing back, startup the EventRecorder now 568 // If we're recording or playing back, startup the EventRecorder now
565 // unless otherwise specified. 569 // unless otherwise specified.
566 if (!command_line_.HasSwitch(switches::kNoEvents)) { 570 if (!command_line_.HasSwitch(switches::kNoEvents)) {
567 FilePath script_path; 571 FilePath script_path;
568 PathService::Get(chrome::FILE_RECORDED_SCRIPT, &script_path); 572 PathService::Get(chrome::FILE_RECORDED_SCRIPT, &script_path);
569 573
570 bool record_mode = command_line_.HasSwitch(switches::kRecordMode); 574 bool record_mode = command_line_.HasSwitch(switches::kRecordMode);
571 bool playback_mode = command_line_.HasSwitch(switches::kPlaybackMode); 575 bool playback_mode = command_line_.HasSwitch(switches::kPlaybackMode);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 browser = Browser::Create(profile_); 739 browser = Browser::Create(profile_);
736 } else { 740 } else {
737 #if defined(TOOLKIT_GTK) 741 #if defined(TOOLKIT_GTK)
738 // Setting the time of the last action on the window here allows us to steal 742 // Setting the time of the last action on the window here allows us to steal
739 // focus, which is what the user wants when opening a new tab in an existing 743 // focus, which is what the user wants when opening a new tab in an existing
740 // browser window. 744 // browser window.
741 gtk_util::SetWMLastUserActionTime(browser->window()->GetNativeHandle()); 745 gtk_util::SetWMLastUserActionTime(browser->window()->GetNativeHandle());
742 #endif 746 #endif
743 } 747 }
744 748
745 #if !defined(OS_MACOSX)
746 // In kiosk mode, we want to always be fullscreen, so switch to that now.
747 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
748 browser->ToggleFullscreenMode();
749 #endif
750
751 bool first_tab = true; 749 bool first_tab = true;
752 for (size_t i = 0; i < tabs.size(); ++i) { 750 for (size_t i = 0; i < tabs.size(); ++i) {
753 // We skip URLs that we'd have to launch an external protocol handler for. 751 // We skip URLs that we'd have to launch an external protocol handler for.
754 // This avoids us getting into an infinite loop asking ourselves to open 752 // This avoids us getting into an infinite loop asking ourselves to open
755 // a URL, should the handler be (incorrectly) configured to be us. Anyone 753 // a URL, should the handler be (incorrectly) configured to be us. Anyone
756 // asking us to open such a URL should really ask the handler directly. 754 // asking us to open such a URL should really ask the handler directly.
757 if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url)) 755 if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url))
758 continue; 756 continue;
759 757
760 int add_types = first_tab ? TabStripModel::ADD_SELECTED : 758 int add_types = first_tab ? TabStripModel::ADD_SELECTED :
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 scoped_refptr<AutomationProviderClass> automation = 1050 scoped_refptr<AutomationProviderClass> automation =
1053 new AutomationProviderClass(profile); 1051 new AutomationProviderClass(profile);
1054 automation->ConnectToChannel(channel_id); 1052 automation->ConnectToChannel(channel_id);
1055 automation->SetExpectedTabCount(expected_tabs); 1053 automation->SetExpectedTabCount(expected_tabs);
1056 1054
1057 AutomationProviderList* list = 1055 AutomationProviderList* list =
1058 g_browser_process->InitAutomationProviderList(); 1056 g_browser_process->InitAutomationProviderList();
1059 DCHECK(list); 1057 DCHECK(list);
1060 list->AddProvider(automation); 1058 list->AddProvider(automation);
1061 } 1059 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698