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_tab_util.h" | 5 #include "chrome/browser/extensions/extension_tab_util.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
51 namespace keys = tabs_constants; | 51 namespace keys = tabs_constants; |
52 | 52 |
53 WindowController* GetAppWindowController(const WebContents* contents) { | 53 WindowController* GetAppWindowController(const WebContents* contents) { |
54 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 54 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
55 AppWindowRegistry* registry = AppWindowRegistry::Get(profile); | 55 AppWindowRegistry* registry = AppWindowRegistry::Get(profile); |
56 if (!registry) | 56 if (!registry) |
57 return NULL; | 57 return NULL; |
58 AppWindow* app_window = | 58 AppWindow* app_window = registry->GetAppWindowForWebContents(contents); |
59 registry->GetAppWindowForRenderViewHost(contents->GetRenderViewHost()); | |
60 if (!app_window) | 59 if (!app_window) |
61 return NULL; | 60 return NULL; |
62 return WindowControllerList::GetInstance()->FindWindowById( | 61 return WindowControllerList::GetInstance()->FindWindowById( |
63 app_window->session_id().id()); | 62 app_window->session_id().id()); |
64 } | 63 } |
65 | 64 |
66 // |error_message| can optionally be passed in and will be set with an | 65 // |error_message| can optionally be passed in and will be set with an |
67 // appropriate message if the window cannot be found by id. | 66 // appropriate message if the window cannot be found by id. |
68 Browser* GetBrowserInProfileWithId(Profile* profile, | 67 Browser* GetBrowserInProfileWithId(Profile* profile, |
69 const int window_id, | 68 const int window_id, |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 610 |
612 chrome::NavigateParams params( | 611 chrome::NavigateParams params( |
613 chrome::GetSingletonTabNavigateParams(browser, url_to_navigate)); | 612 chrome::GetSingletonTabNavigateParams(browser, url_to_navigate)); |
614 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 613 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
615 params.url = url_to_navigate; | 614 params.url = url_to_navigate; |
616 chrome::ShowSingletonTabOverwritingNTP(browser, params); | 615 chrome::ShowSingletonTabOverwritingNTP(browser, params); |
617 return true; | 616 return true; |
618 } | 617 } |
619 | 618 |
620 } // namespace extensions | 619 } // namespace extensions |
OLD | NEW |