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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 if (ash::Shell::GetInstance()->display_manager()->num_connected_displays() > 460 if (ash::Shell::GetInstance()->display_manager()->num_connected_displays() >
461 2) { 461 2) {
462 return; 462 return;
463 } 463 }
464 content::RecordAction(base::UserMetricsAction("ShowDisplayOptions")); 464 content::RecordAction(base::UserMetricsAction("ShowDisplayOptions"));
465 ShowSettingsSubPageForActiveUser(kDisplaySettingsSubPageName); 465 ShowSettingsSubPageForActiveUser(kDisplaySettingsSubPageName);
466 } 466 }
467 467
468 void SystemTrayDelegateChromeOS::ShowChromeSlow() { 468 void SystemTrayDelegateChromeOS::ShowChromeSlow() {
469 chrome::ScopedTabbedBrowserDisplayer displayer( 469 chrome::ScopedTabbedBrowserDisplayer displayer(
470 ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); 470 ProfileManager::GetPrimaryUserProfile(), ui::HOST_DESKTOP_TYPE_ASH);
471 chrome::ShowSlow(displayer.browser()); 471 chrome::ShowSlow(displayer.browser());
472 } 472 }
473 473
474 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() { 474 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() {
475 // Packaged app is not counted as 'last active', so if a browser opening the 475 // Packaged app is not counted as 'last active', so if a browser opening the
476 // display settings is in background of a packaged app, it will return true. 476 // display settings is in background of a packaged app, it will return true.
477 // TODO(mukai): fix this. 477 // TODO(mukai): fix this.
478 Browser* active_browser = 478 Browser* active_browser =
479 chrome::FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_ASH); 479 chrome::FindLastActiveWithHostDesktopType(ui::HOST_DESKTOP_TYPE_ASH);
480 if (!active_browser) 480 if (!active_browser)
481 return true; 481 return true;
482 482
483 content::WebContents* active_contents = 483 content::WebContents* active_contents =
484 active_browser->tab_strip_model()->GetActiveWebContents(); 484 active_browser->tab_strip_model()->GetActiveWebContents();
485 if (!active_contents) 485 if (!active_contents)
486 return true; 486 return true;
487 487
488 GURL visible_url = active_contents->GetLastCommittedURL(); 488 GURL visible_url = active_contents->GetLastCommittedURL();
489 return !(chrome::IsSettingsSubPage(visible_url, 489 return !(chrome::IsSettingsSubPage(visible_url,
490 kDisplaySettingsSubPageName) || 490 kDisplaySettingsSubPageName) ||
491 chrome::IsSettingsSubPage(visible_url, 491 chrome::IsSettingsSubPage(visible_url,
492 kDisplayOverscanSettingsSubPageName)); 492 kDisplayOverscanSettingsSubPageName));
493 } 493 }
494 494
495 void SystemTrayDelegateChromeOS::ShowIMESettings() { 495 void SystemTrayDelegateChromeOS::ShowIMESettings() {
496 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); 496 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog"));
497 ShowSettingsSubPageForActiveUser(chrome::kLanguageOptionsSubPage); 497 ShowSettingsSubPageForActiveUser(chrome::kLanguageOptionsSubPage);
498 } 498 }
499 499
500 void SystemTrayDelegateChromeOS::ShowHelp() { 500 void SystemTrayDelegateChromeOS::ShowHelp() {
501 chrome::ShowHelpForProfile(ProfileManager::GetActiveUserProfile(), 501 chrome::ShowHelpForProfile(ProfileManager::GetActiveUserProfile(),
502 chrome::HOST_DESKTOP_TYPE_ASH, 502 ui::HOST_DESKTOP_TYPE_ASH,
503 chrome::HELP_SOURCE_MENU); 503 chrome::HELP_SOURCE_MENU);
504 } 504 }
505 505
506 void SystemTrayDelegateChromeOS::ShowAccessibilityHelp() { 506 void SystemTrayDelegateChromeOS::ShowAccessibilityHelp() {
507 chrome::ScopedTabbedBrowserDisplayer displayer( 507 chrome::ScopedTabbedBrowserDisplayer displayer(
508 ProfileManager::GetActiveUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); 508 ProfileManager::GetActiveUserProfile(), ui::HOST_DESKTOP_TYPE_ASH);
509 accessibility::ShowAccessibilityHelp(displayer.browser()); 509 accessibility::ShowAccessibilityHelp(displayer.browser());
510 } 510 }
511 511
512 void SystemTrayDelegateChromeOS::ShowAccessibilitySettings() { 512 void SystemTrayDelegateChromeOS::ShowAccessibilitySettings() {
513 content::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings")); 513 content::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings"));
514 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + 514 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" +
515 l10n_util::GetStringUTF8( 515 l10n_util::GetStringUTF8(
516 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY); 516 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY);
517 ShowSettingsSubPageForActiveUser(sub_page); 517 ShowSettingsSubPageForActiveUser(sub_page);
518 } 518 }
519 519
520 void SystemTrayDelegateChromeOS::ShowPublicAccountInfo() { 520 void SystemTrayDelegateChromeOS::ShowPublicAccountInfo() {
521 chrome::ScopedTabbedBrowserDisplayer displayer( 521 chrome::ScopedTabbedBrowserDisplayer displayer(
522 ProfileManager::GetActiveUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); 522 ProfileManager::GetActiveUserProfile(), ui::HOST_DESKTOP_TYPE_ASH);
523 chrome::ShowPolicy(displayer.browser()); 523 chrome::ShowPolicy(displayer.browser());
524 } 524 }
525 525
526 void SystemTrayDelegateChromeOS::ShowSupervisedUserInfo() { 526 void SystemTrayDelegateChromeOS::ShowSupervisedUserInfo() {
527 // TODO(antrim): find out what should we show in this case. 527 // TODO(antrim): find out what should we show in this case.
528 // http://crbug.com/229762 528 // http://crbug.com/229762
529 } 529 }
530 530
531 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { 531 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() {
532 ash::user::LoginStatus status = GetUserLoginStatus(); 532 ash::user::LoginStatus status = GetUserLoginStatus();
533 bool userAddingRunning = ash::Shell::GetInstance() 533 bool userAddingRunning = ash::Shell::GetInstance()
534 ->session_state_delegate() 534 ->session_state_delegate()
535 ->IsInSecondaryLoginScreen(); 535 ->IsInSecondaryLoginScreen();
536 536
537 if (status == ash::user::LOGGED_IN_NONE || 537 if (status == ash::user::LOGGED_IN_NONE ||
538 status == ash::user::LOGGED_IN_LOCKED || userAddingRunning) { 538 status == ash::user::LOGGED_IN_LOCKED || userAddingRunning) {
539 scoped_refptr<chromeos::HelpAppLauncher> help_app( 539 scoped_refptr<chromeos::HelpAppLauncher> help_app(
540 new chromeos::HelpAppLauncher(GetNativeWindow())); 540 new chromeos::HelpAppLauncher(GetNativeWindow()));
541 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); 541 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE);
542 } else { 542 } else {
543 chrome::ScopedTabbedBrowserDisplayer displayer( 543 chrome::ScopedTabbedBrowserDisplayer displayer(
544 ProfileManager::GetActiveUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); 544 ProfileManager::GetActiveUserProfile(), ui::HOST_DESKTOP_TYPE_ASH);
545 chrome::ShowSingletonTab(displayer.browser(), 545 chrome::ShowSingletonTab(displayer.browser(),
546 GURL(chrome::kLearnMoreEnterpriseURL)); 546 GURL(chrome::kLearnMoreEnterpriseURL));
547 } 547 }
548 } 548 }
549 549
550 void SystemTrayDelegateChromeOS::ShowUserLogin() { 550 void SystemTrayDelegateChromeOS::ShowUserLogin() {
551 ash::Shell* shell = ash::Shell::GetInstance(); 551 ash::Shell* shell = ash::Shell::GetInstance();
552 if (!shell->delegate()->IsMultiProfilesEnabled()) 552 if (!shell->delegate()->IsMultiProfilesEnabled())
553 return; 553 return;
554 554
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 user_profile_); 1030 user_profile_);
1031 if (service) 1031 if (service)
1032 service->RemoveObserver(this); 1032 service->RemoveObserver(this);
1033 } 1033 }
1034 1034
1035 void SystemTrayDelegateChromeOS::NotifyIfLastWindowClosed() { 1035 void SystemTrayDelegateChromeOS::NotifyIfLastWindowClosed() {
1036 if (!user_profile_) 1036 if (!user_profile_)
1037 return; 1037 return;
1038 1038
1039 BrowserList* browser_list = 1039 BrowserList* browser_list =
1040 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); 1040 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH);
1041 for (BrowserList::const_iterator it = browser_list->begin(); 1041 for (BrowserList::const_iterator it = browser_list->begin();
1042 it != browser_list->end(); 1042 it != browser_list->end();
1043 ++it) { 1043 ++it) {
1044 if ((*it)->profile()->IsSameProfile(user_profile_)) { 1044 if ((*it)->profile()->IsSameProfile(user_profile_)) {
1045 // The current user has at least one open browser window. 1045 // The current user has at least one open browser window.
1046 return; 1046 return;
1047 } 1047 }
1048 } 1048 }
1049 1049
1050 if (!extensions::AppWindowRegistry::Get( 1050 if (!extensions::AppWindowRegistry::Get(
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1327 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1328 << "ENABLE_SUPERVISED_USERS undefined."; 1328 << "ENABLE_SUPERVISED_USERS undefined.";
1329 return base::string16(); 1329 return base::string16();
1330 } 1330 }
1331 1331
1332 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1332 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1333 return new SystemTrayDelegateChromeOS(); 1333 return new SystemTrayDelegateChromeOS();
1334 } 1334 }
1335 1335
1336 } // namespace chromeos 1336 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698