| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "apps/switches.h" | 8 #include "apps/switches.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 void Wait() { | 118 void Wait() { |
| 119 if (observed_) | 119 if (observed_) |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 run_loop_.reset(new base::RunLoop); | 122 run_loop_.reset(new base::RunLoop); |
| 123 run_loop_->Run(); | 123 run_loop_->Run(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // AppShimHandler overrides: | 126 // AppShimHandler overrides: |
| 127 virtual void OnShimLaunch(Host* host, | 127 void OnShimLaunch(Host* host, |
| 128 apps::AppShimLaunchType launch_type, | 128 apps::AppShimLaunchType launch_type, |
| 129 const std::vector<base::FilePath>& files) override { | 129 const std::vector<base::FilePath>& files) override { |
| 130 // Remove self and pass through to the default handler. | 130 // Remove self and pass through to the default handler. |
| 131 apps::AppShimHandler::RemoveHandler(app_mode_id_); | 131 apps::AppShimHandler::RemoveHandler(app_mode_id_); |
| 132 apps::AppShimHandler::GetForAppMode(app_mode_id_) | 132 apps::AppShimHandler::GetForAppMode(app_mode_id_) |
| 133 ->OnShimLaunch(host, launch_type, files); | 133 ->OnShimLaunch(host, launch_type, files); |
| 134 observed_ = true; | 134 observed_ = true; |
| 135 if (run_loop_.get()) | 135 if (run_loop_.get()) |
| 136 run_loop_->Quit(); | 136 run_loop_->Quit(); |
| 137 } | 137 } |
| 138 virtual void OnShimClose(Host* host) override {} | 138 void OnShimClose(Host* host) override {} |
| 139 virtual void OnShimFocus(Host* host, | 139 void OnShimFocus(Host* host, |
| 140 apps::AppShimFocusType focus_type, | 140 apps::AppShimFocusType focus_type, |
| 141 const std::vector<base::FilePath>& files) override {} | 141 const std::vector<base::FilePath>& files) override {} |
| 142 virtual void OnShimSetHidden(Host* host, bool hidden) override {} | 142 void OnShimSetHidden(Host* host, bool hidden) override {} |
| 143 virtual void OnShimQuit(Host* host) override {} | 143 void OnShimQuit(Host* host) override {} |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 std::string app_mode_id_; | 146 std::string app_mode_id_; |
| 147 bool observed_; | 147 bool observed_; |
| 148 scoped_ptr<base::RunLoop> run_loop_; | 148 scoped_ptr<base::RunLoop> run_loop_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(WindowedAppShimLaunchObserver); | 150 DISALLOW_COPY_AND_ASSIGN(WindowedAppShimLaunchObserver); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 NSString* GetBundleID(const base::FilePath& shim_path) { | 153 NSString* GetBundleID(const base::FilePath& shim_path) { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // the shim is rebuilt. | 398 // the shim is rebuilt. |
| 399 WindowedAppShimLaunchObserver(app->id()).Wait(); | 399 WindowedAppShimLaunchObserver(app->id()).Wait(); |
| 400 | 400 |
| 401 EXPECT_TRUE(GetFirstAppWindow()); | 401 EXPECT_TRUE(GetFirstAppWindow()); |
| 402 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); | 402 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); |
| 403 } | 403 } |
| 404 | 404 |
| 405 #endif // defined(ARCH_CPU_64_BITS) | 405 #endif // defined(ARCH_CPU_64_BITS) |
| 406 | 406 |
| 407 } // namespace apps | 407 } // namespace apps |
| OLD | NEW |