| 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 package com.android.webview.chromium; | 5 package com.android.webview.chromium; |
| 6 | 6 |
| 7 import android.content.ComponentCallbacks; | 7 import android.content.ComponentCallbacks; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.ContextWrapper; | 9 import android.content.ContextWrapper; |
| 10 import android.view.LayoutInflater; | 10 import android.view.LayoutInflater; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (Context.LAYOUT_INFLATER_SERVICE.equals(name)) { | 67 if (Context.LAYOUT_INFLATER_SERVICE.equals(name)) { |
| 68 LayoutInflater i = (LayoutInflater) getBaseContext().getSyst
emService(name); | 68 LayoutInflater i = (LayoutInflater) getBaseContext().getSyst
emService(name); |
| 69 return i.cloneInContext(this); | 69 return i.cloneInContext(this); |
| 70 } else { | 70 } else { |
| 71 return getBaseContext().getSystemService(name); | 71 return getBaseContext().getSystemService(name); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 @Override | 75 @Override |
| 76 public Context getApplicationContext() { | 76 public Context getApplicationContext() { |
| 77 if (mApplicationContext == null) | 77 if (mApplicationContext == null) { |
| 78 mApplicationContext = get(ctx.getApplicationContext()); | 78 mApplicationContext = get(ctx.getApplicationContext()); |
| 79 } |
| 79 return mApplicationContext; | 80 return mApplicationContext; |
| 80 } | 81 } |
| 81 | 82 |
| 82 @Override | 83 @Override |
| 83 public void registerComponentCallbacks(ComponentCallbacks callback)
{ | 84 public void registerComponentCallbacks(ComponentCallbacks callback)
{ |
| 84 // We have to override registerComponentCallbacks and unregister
ComponentCallbacks | 85 // We have to override registerComponentCallbacks and unregister
ComponentCallbacks |
| 85 // since they call getApplicationContext().[un]registerComponent
Callbacks() | 86 // since they call getApplicationContext().[un]registerComponent
Callbacks() |
| 86 // which causes us to go into a loop. | 87 // which causes us to go into a loop. |
| 87 ctx.registerComponentCallbacks(callback); | 88 ctx.registerComponentCallbacks(callback); |
| 88 } | 89 } |
| 89 | 90 |
| 90 @Override | 91 @Override |
| 91 public void unregisterComponentCallbacks(ComponentCallbacks callback
) { | 92 public void unregisterComponentCallbacks(ComponentCallbacks callback
) { |
| 92 ctx.unregisterComponentCallbacks(callback); | 93 ctx.unregisterComponentCallbacks(callback); |
| 93 } | 94 } |
| 94 }; | 95 }; |
| 95 } | 96 } |
| 96 } | 97 } |
| OLD | NEW |