class ScreenOrientationProviderTizen :
public content::ScreenOrientationProvider {
public:
- explicit ScreenOrientationProviderTizen(const base::WeakPtr<Application>& app)
+ ScreenOrientationProviderTizen(
+ const base::WeakPtr<Application>& app,
+ content::ScreenOrientationDispatcherHost* dispatcher)
: app_(app),
+ dispatcher_(dispatcher),
request_id_(0) {
+ DCHECK(dispatcher_);
}
virtual void LockOrientation(
int request_id,
blink::WebScreenOrientationLockType lock) OVERRIDE {
- if (!app_)
+ if (!app_) {
+ dispatcher_->NotifyLockError(
+ request_id,
+ blink::WebLockOrientationError::WebLockOrientationErrorNotAvailable);
return;
+ }
request_id_ = request_id;
const std::set<Runtime*>& runtimes = app_->runtimes();
DCHECK(!runtimes.empty());
break;
}
}
+ dispatcher_->NotifyLockSuccess(request_id);
}
virtual void UnlockOrientation() OVERRIDE {
private:
base::WeakPtr<Application> app_;
+ content::ScreenOrientationDispatcherHost* dispatcher_;
int request_id_;
};
if (audio_host.get())
audio_host->SetMediaStreamProperties(id(), app_class);
- content::ScreenOrientationProvider *provider =
- new ScreenOrientationProviderTizen(GetWeakPtr());
- web_contents_->GetScreenOrientationDispatcherHost()->SetProvider(provider);
+ content::ScreenOrientationDispatcherHost* host =
+ web_contents_->GetScreenOrientationDispatcherHost();
+ content::ScreenOrientationProvider* provider =
+ new ScreenOrientationProviderTizen(GetWeakPtr(), host);
+ host->SetProvider(provider);
provider->LockOrientation(0, GetDefaultOrientation(GetWeakPtr()));
return true;
return base::FilePath();
}
+bool ApplicationTizen::CanBeSuspended() const {
+ if (TizenSettingInfo* setting = static_cast<TizenSettingInfo*>(
+ data()->GetManifestData(widget_keys::kTizenSettingKey))) {
+ return !setting->background_support_enabled();
+ }
+ return true;
+}
+
void ApplicationTizen::Suspend() {
- if (is_suspended_)
+ if (is_suspended_ || !CanBeSuspended())
return;
DCHECK(render_process_host_);
}
void ApplicationTizen::Resume() {
- if (!is_suspended_)
+ if (!is_suspended_ || !CanBeSuspended())
return;
DCHECK(render_process_host_);