| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 public: | 56 public: |
| 57 ActiveTabTest() | 57 ActiveTabTest() |
| 58 : current_channel_(chrome::VersionInfo::CHANNEL_DEV), | 58 : current_channel_(chrome::VersionInfo::CHANNEL_DEV), |
| 59 extension(CreateTestExtension("deadbeef", true)), | 59 extension(CreateTestExtension("deadbeef", true)), |
| 60 another_extension(CreateTestExtension("feedbeef", true)), | 60 another_extension(CreateTestExtension("feedbeef", true)), |
| 61 extension_without_active_tab(CreateTestExtension("badbeef", false)), | 61 extension_without_active_tab(CreateTestExtension("badbeef", false)), |
| 62 ui_thread_(BrowserThread::UI, MessageLoop::current()) {} | 62 ui_thread_(BrowserThread::UI, MessageLoop::current()) {} |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 int tab_id() { | 65 int tab_id() { |
| 66 return SessionID::IdForTab(tab_contents()); | 66 return SessionID::IdForTab(tab_contents()->web_contents()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 ActiveTabPermissionManager* active_tab_permission_manager() { | 69 ActiveTabPermissionManager* active_tab_permission_manager() { |
| 70 return extensions::TabHelper::FromWebContents(web_contents())-> | 70 return extensions::TabHelper::FromWebContents(web_contents())-> |
| 71 active_tab_permission_manager(); | 71 active_tab_permission_manager(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool IsAllowed(const scoped_refptr<const Extension>& extension, | 74 bool IsAllowed(const scoped_refptr<const Extension>& extension, |
| 75 const GURL& url) { | 75 const GURL& url) { |
| 76 return IsAllowed(extension, url, tab_id()); | 76 return IsAllowed(extension, url, tab_id()); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 Reload(); | 314 Reload(); |
| 315 | 315 |
| 316 EXPECT_FALSE(IsAllowed(extension, google, tab_id())); | 316 EXPECT_FALSE(IsAllowed(extension, google, tab_id())); |
| 317 EXPECT_FALSE(IsAllowed(extension, google_h1, tab_id())); | 317 EXPECT_FALSE(IsAllowed(extension, google_h1, tab_id())); |
| 318 EXPECT_FALSE(IsAllowed(extension, chromium, tab_id())); | 318 EXPECT_FALSE(IsAllowed(extension, chromium, tab_id())); |
| 319 EXPECT_FALSE(IsAllowed(extension, chromium_h1, tab_id())); | 319 EXPECT_FALSE(IsAllowed(extension, chromium_h1, tab_id())); |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace | 322 } // namespace |
| 323 } // namespace extensions | 323 } // namespace extensions |
| OLD | NEW |