| 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 #include "athena/extensions/athena_app_delegate_base.h" | 5 #include "athena/extensions/athena_app_delegate_base.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity.h" |
| 7 #include "athena/activity/public/activity_factory.h" | 8 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/env/public/athena_env.h" | 9 #include "athena/env/public/athena_env.h" |
| 9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/browser/web_contents_delegate.h" | 11 #include "content/public/browser/web_contents_delegate.h" |
| 11 #include "extensions/common/constants.h" | 12 #include "extensions/common/constants.h" |
| 12 #include "extensions/grit/extensions_browser_resources.h" | 13 #include "extensions/grit/extensions_browser_resources.h" |
| 13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 | 17 |
| 17 namespace athena { | 18 namespace athena { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 content::WebContents* OpenURLInActivity(content::BrowserContext* context, | 21 content::WebContents* OpenURLInActivity(content::BrowserContext* context, |
| 21 const content::OpenURLParams& params) { | 22 const content::OpenURLParams& params) { |
| 22 // Force all links to open in a new activity. | 23 // Force all links to open in a new activity. |
| 23 Activity* activity = ActivityFactory::Get()->CreateWebActivity( | 24 Activity* activity = ActivityFactory::Get()->CreateWebActivity( |
| 24 context, base::string16(), params.url); | 25 context, base::string16(), params.url); |
| 25 DCHECK(activity); | 26 Activity::Show(activity); |
| 26 // TODO(oshima): Get the web cotnents from activity. | 27 // TODO(oshima): Get the web cotnents from activity. |
| 27 return NULL; | 28 return NULL; |
| 28 } | 29 } |
| 29 | 30 |
| 30 } // namespace | 31 } // namespace |
| 31 | 32 |
| 32 // This is a extra step to open a new Activity when a link is simply clicked | 33 // This is a extra step to open a new Activity when a link is simply clicked |
| 33 // on an app activity (which usually replaces the content). | 34 // on an app activity (which usually replaces the content). |
| 34 class AthenaAppDelegateBase::NewActivityContentsDelegate | 35 class AthenaAppDelegateBase::NewActivityContentsDelegate |
| 35 : public content::WebContentsDelegate { | 36 : public content::WebContentsDelegate { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void AthenaAppDelegateBase::SetTerminatingCallback( | 96 void AthenaAppDelegateBase::SetTerminatingCallback( |
| 96 const base::Closure& callback) { | 97 const base::Closure& callback) { |
| 97 if (!terminating_callback_.is_null()) | 98 if (!terminating_callback_.is_null()) |
| 98 AthenaEnv::Get()->RemoveTerminatingCallback(terminating_callback_); | 99 AthenaEnv::Get()->RemoveTerminatingCallback(terminating_callback_); |
| 99 terminating_callback_ = callback; | 100 terminating_callback_ = callback; |
| 100 if (!terminating_callback_.is_null()) | 101 if (!terminating_callback_.is_null()) |
| 101 AthenaEnv::Get()->AddTerminatingCallback(terminating_callback_); | 102 AthenaEnv::Get()->AddTerminatingCallback(terminating_callback_); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace athena | 105 } // namespace athena |
| OLD | NEW |