X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fextensions%2Fapi%2Fnotifications%2Fnotifications_api.cc;h=3830a7cf3358656bc3cd5745470456688d1350d0;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=631dbf4b219164e35619178184d2440805a7cc69;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/extensions/api/notifications/notifications_api.cc b/src/chrome/browser/extensions/api/notifications/notifications_api.cc index 631dbf4..3830a7c 100644 --- a/src/chrome/browser/extensions/api/notifications/notifications_api.cc +++ b/src/chrome/browser/extensions/api/notifications/notifications_api.cc @@ -85,11 +85,7 @@ class NotificationsApiDelegate : public NotificationDelegate { DCHECK(api_function_.get()); } - virtual void Display() OVERRIDE { } - - virtual void Error() OVERRIDE {} - - virtual void Close(bool by_user) OVERRIDE { + void Close(bool by_user) override { EventRouter::UserGestureState gesture = by_user ? EventRouter::USER_GESTURE_ENABLED : EventRouter::USER_GESTURE_NOT_ENABLED; @@ -98,19 +94,19 @@ class NotificationsApiDelegate : public NotificationDelegate { SendEvent(notifications::OnClosed::kEventName, gesture, args.Pass()); } - virtual void Click() OVERRIDE { + void Click() override { scoped_ptr args(CreateBaseEventArgs()); SendEvent(notifications::OnClicked::kEventName, EventRouter::USER_GESTURE_ENABLED, args.Pass()); } - virtual bool HasClickedListener() OVERRIDE { + bool HasClickedListener() override { return EventRouter::Get(profile_)->HasEventListener( notifications::OnClicked::kEventName); } - virtual void ButtonClick(int index) OVERRIDE { + void ButtonClick(int index) override { scoped_ptr args(CreateBaseEventArgs()); args->Append(new base::FundamentalValue(index)); SendEvent(notifications::OnButtonClicked::kEventName, @@ -118,29 +114,10 @@ class NotificationsApiDelegate : public NotificationDelegate { args.Pass()); } - virtual std::string id() const OVERRIDE { - return scoped_id_; - } - - virtual content::WebContents* GetWebContents() const OVERRIDE { - // We're holding a reference to api_function_, so we know it'll be valid - // until ReleaseRVH is called, and api_function_ (as a - // AsyncExtensionFunction) will zero out its copy of render_view_host - // when the RVH goes away. - if (!api_function_.get()) - return NULL; - content::RenderViewHost* rvh = api_function_->render_view_host(); - if (!rvh) - return NULL; - return content::WebContents::FromRenderViewHost(rvh); - } - - virtual void ReleaseRenderViewHost() OVERRIDE { - api_function_ = NULL; - } + std::string id() const override { return scoped_id_; } private: - virtual ~NotificationsApiDelegate() {} + ~NotificationsApiDelegate() override {} void SendEvent(const std::string& name, EventRouter::UserGestureState user_gesture, @@ -536,7 +513,8 @@ bool NotificationsUpdateFunction::RunNotificationsApi() { // with "false". const Notification* matched_notification = g_browser_process->notification_ui_manager()->FindById( - CreateScopedIdentifier(extension_->id(), params_->notification_id)); + CreateScopedIdentifier(extension_->id(), params_->notification_id), + NotificationUIManager::GetProfileID(GetProfile())); if (!matched_notification) { SetResult(new base::FundamentalValue(false)); SendResponse(true); @@ -573,7 +551,8 @@ bool NotificationsClearFunction::RunNotificationsApi() { EXTENSION_FUNCTION_VALIDATE(params_.get()); bool cancel_result = g_browser_process->notification_ui_manager()->CancelById( - CreateScopedIdentifier(extension_->id(), params_->notification_id)); + CreateScopedIdentifier(extension_->id(), params_->notification_id), + NotificationUIManager::GetProfileID(GetProfile())); SetResult(new base::FundamentalValue(cancel_result)); SendResponse(true);