OLD | NEW |
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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 const char kChromeServiceName[] = "chrome"; | 497 const char kChromeServiceName[] = "chrome"; |
498 | 498 |
499 // Packaged service implementation used to expose miscellaneous application | 499 // Packaged service implementation used to expose miscellaneous application |
500 // control features. This is a singleton service which runs on the main thread | 500 // control features. This is a singleton service which runs on the main thread |
501 // and never stops. | 501 // and never stops. |
502 class ChromeServiceChromeOS | 502 class ChromeServiceChromeOS |
503 : public service_manager::Service, | 503 : public service_manager::Service, |
504 public mash::mojom::Launchable, | 504 public mash::mojom::Launchable, |
505 public service_manager::InterfaceFactory<mash::mojom::Launchable> { | 505 public service_manager::InterfaceFactory<mash::mojom::Launchable> { |
506 public: | 506 public: |
507 ChromeServiceChromeOS() | 507 ChromeServiceChromeOS() { |
508 : interfaces_(service_manager::mojom::kServiceManager_ConnectorSpec) { | |
509 interfaces_.AddInterface<mash::mojom::Launchable>(this); | 508 interfaces_.AddInterface<mash::mojom::Launchable>(this); |
510 } | 509 } |
511 ~ChromeServiceChromeOS() override {} | 510 ~ChromeServiceChromeOS() override {} |
512 | 511 |
513 static std::unique_ptr<service_manager::Service> CreateService() { | 512 static std::unique_ptr<service_manager::Service> CreateService() { |
514 return base::MakeUnique<ChromeServiceChromeOS>(); | 513 return base::MakeUnique<ChromeServiceChromeOS>(); |
515 } | 514 } |
516 | 515 |
517 private: | 516 private: |
518 void CreateNewWindowImpl(bool is_incognito) { | 517 void CreateNewWindowImpl(bool is_incognito) { |
519 Profile* profile = ProfileManager::GetActiveUserProfile(); | 518 Profile* profile = ProfileManager::GetActiveUserProfile(); |
520 chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile() | 519 chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile() |
521 : profile); | 520 : profile); |
522 } | 521 } |
523 | 522 |
524 // service_manager::Service: | 523 // service_manager::Service: |
525 void OnBindInterface(const service_manager::ServiceInfo& remote_info, | 524 void OnBindInterface(const service_manager::ServiceInfo& remote_info, |
526 const std::string& name, | 525 const std::string& name, |
527 mojo::ScopedMessagePipeHandle handle) override { | 526 mojo::ScopedMessagePipeHandle handle) override { |
528 interfaces_.BindInterface(name, std::move(handle)); | 527 interfaces_.BindInterface(remote_info.identity, name, std::move(handle)); |
529 } | 528 } |
530 | 529 |
531 // mash::mojom::Launchable: | 530 // mash::mojom::Launchable: |
532 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { | 531 void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
533 if (how != mash::mojom::LaunchMode::MAKE_NEW) { | 532 if (how != mash::mojom::LaunchMode::MAKE_NEW) { |
534 LOG(ERROR) << "Unable to handle Launch request with how = " << how; | 533 LOG(ERROR) << "Unable to handle Launch request with how = " << how; |
535 return; | 534 return; |
536 } | 535 } |
537 switch (what) { | 536 switch (what) { |
538 case mash::mojom::kWindow: | 537 case mash::mojom::kWindow: |
539 CreateNewWindowImpl(false /* is_incognito */); | 538 CreateNewWindowImpl(false /* is_incognito */); |
540 break; | 539 break; |
541 case mash::mojom::kIncognitoWindow: | 540 case mash::mojom::kIncognitoWindow: |
542 CreateNewWindowImpl(true /* is_incognito */); | 541 CreateNewWindowImpl(true /* is_incognito */); |
543 break; | 542 break; |
544 default: | 543 default: |
545 NOTREACHED(); | 544 NOTREACHED(); |
546 } | 545 } |
547 } | 546 } |
548 | 547 |
549 // mojo::InterfaceFactory<mash::mojom::Launchable>: | 548 // mojo::InterfaceFactory<mash::mojom::Launchable>: |
550 void Create(const service_manager::Identity& remote_identity, | 549 void Create(const service_manager::Identity& remote_identity, |
551 mash::mojom::LaunchableRequest request) override { | 550 mash::mojom::LaunchableRequest request) override { |
552 bindings_.AddBinding(this, std::move(request)); | 551 bindings_.AddBinding(this, std::move(request)); |
553 } | 552 } |
554 | 553 |
555 service_manager::InterfaceRegistry interfaces_; | 554 service_manager::BinderRegistry interfaces_; |
556 mojo::BindingSet<mash::mojom::Launchable> bindings_; | 555 mojo::BindingSet<mash::mojom::Launchable> bindings_; |
557 | 556 |
558 DISALLOW_COPY_AND_ASSIGN(ChromeServiceChromeOS); | 557 DISALLOW_COPY_AND_ASSIGN(ChromeServiceChromeOS); |
559 }; | 558 }; |
560 | 559 |
561 #endif // defined(OS_CHROMEOS) | 560 #endif // defined(OS_CHROMEOS) |
562 | 561 |
563 // Returns a copy of the given url with its host set to given host and path set | 562 // Returns a copy of the given url with its host set to given host and path set |
564 // to given path. Other parts of the url will be the same. | 563 // to given path. Other parts of the url will be the same. |
565 GURL ReplaceURLHostAndPath(const GURL& url, | 564 GURL ReplaceURLHostAndPath(const GURL& url, |
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3620 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3619 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3621 return variations::GetVariationParamValue( | 3620 return variations::GetVariationParamValue( |
3622 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3621 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3623 } | 3622 } |
3624 | 3623 |
3625 // static | 3624 // static |
3626 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3625 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3627 const storage::QuotaSettings* settings) { | 3626 const storage::QuotaSettings* settings) { |
3628 g_default_quota_settings = settings; | 3627 g_default_quota_settings = settings; |
3629 } | 3628 } |
OLD | NEW |