| 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 "chrome/browser/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 } | 586 } |
| 587 } | 587 } |
| 588 | 588 |
| 589 // Find a browser with a profile that matches the new tab. If none is found, | 589 // Find a browser with a profile that matches the new tab. If none is found, |
| 590 // NULL argument to NavigateParams is valid. | 590 // NULL argument to NavigateParams is valid. |
| 591 Profile* profile = | 591 Profile* profile = |
| 592 Profile::FromBrowserContext(new_contents->GetBrowserContext()); | 592 Profile::FromBrowserContext(new_contents->GetBrowserContext()); |
| 593 Browser* browser = browser::FindTabbedBrowser( | 593 Browser* browser = browser::FindTabbedBrowser( |
| 594 profile, false); // Match incognito exactly. | 594 profile, false); // Match incognito exactly. |
| 595 TabContents* tab_contents = new TabContents(new_contents); | 595 TabContents* tab_contents = new TabContents(new_contents); |
| 596 browser::NavigateParams params(browser, tab_contents); | 596 chrome::NavigateParams params(browser, tab_contents); |
| 597 | 597 |
| 598 // The extension_app_id parameter ends up as app_name in the Browser | 598 // The extension_app_id parameter ends up as app_name in the Browser |
| 599 // which causes the Browser to return true for is_app(). This affects | 599 // which causes the Browser to return true for is_app(). This affects |
| 600 // among other things, whether the location bar gets displayed. | 600 // among other things, whether the location bar gets displayed. |
| 601 // TODO(mpcomplete): This seems wrong. What if the extension content is hosted | 601 // TODO(mpcomplete): This seems wrong. What if the extension content is hosted |
| 602 // in a tab? | 602 // in a tab? |
| 603 if (disposition == NEW_POPUP) | 603 if (disposition == NEW_POPUP) |
| 604 params.extension_app_id = extension_id_; | 604 params.extension_app_id = extension_id_; |
| 605 | 605 |
| 606 if (!browser) | 606 if (!browser) |
| 607 params.profile = profile; | 607 params.profile = profile; |
| 608 params.disposition = disposition; | 608 params.disposition = disposition; |
| 609 params.window_bounds = initial_pos; | 609 params.window_bounds = initial_pos; |
| 610 params.window_action = browser::NavigateParams::SHOW_WINDOW; | 610 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 611 params.user_gesture = user_gesture; | 611 params.user_gesture = user_gesture; |
| 612 browser::Navigate(¶ms); | 612 chrome::Navigate(¶ms); |
| 613 } | 613 } |
| 614 | 614 |
| 615 void ExtensionHost::RenderViewReady() { | 615 void ExtensionHost::RenderViewReady() { |
| 616 content::NotificationService::current()->Notify( | 616 content::NotificationService::current()->Notify( |
| 617 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 617 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 618 content::Source<Profile>(profile_), | 618 content::Source<Profile>(profile_), |
| 619 content::Details<ExtensionHost>(this)); | 619 content::Details<ExtensionHost>(this)); |
| 620 } | 620 } |
| OLD | NEW |