OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2852 // Browser, TabStripModelObserver implementation: | 2852 // Browser, TabStripModelObserver implementation: |
2853 | 2853 |
2854 void Browser::TabInsertedAt(TabContentsWrapper* contents, | 2854 void Browser::TabInsertedAt(TabContentsWrapper* contents, |
2855 int index, | 2855 int index, |
2856 bool foreground) { | 2856 bool foreground) { |
2857 SetAsDelegate(contents, this); | 2857 SetAsDelegate(contents, this); |
2858 contents->controller().SetWindowID(session_id()); | 2858 contents->controller().SetWindowID(session_id()); |
2859 | 2859 |
2860 // Extension code in the renderer holds the ID of the window that hosts it. | 2860 // Extension code in the renderer holds the ID of the window that hosts it. |
2861 // Notify it that the window ID changed. | 2861 // Notify it that the window ID changed. |
2862 // TODO(sky): move this to a better place. | |
2862 contents->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( | 2863 contents->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( |
2863 contents->render_view_host()->routing_id(), | 2864 contents->render_view_host()->routing_id(), |
2864 contents->controller().window_id().id())); | 2865 contents->controller().window_id().id())); |
2865 | 2866 |
2866 SyncHistoryWithTabs(index); | 2867 SyncHistoryWithTabs(index); |
2867 | 2868 |
2868 // Make sure the loading state is updated correctly, otherwise the throbber | 2869 // Make sure the loading state is updated correctly, otherwise the throbber |
2869 // won't start if the page is loading. | 2870 // won't start if the page is loading. |
2870 LoadingStateChanged(contents->tab_contents()); | 2871 LoadingStateChanged(contents->tab_contents()); |
2871 | 2872 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3429 GetSelectedTabContentsWrapper()->bookmark_tab_helper()-> | 3430 GetSelectedTabContentsWrapper()->bookmark_tab_helper()-> |
3430 ShouldShowBookmarkBar()) { | 3431 ShouldShowBookmarkBar()) { |
3431 window()->ShelfVisibilityChanged(); | 3432 window()->ShelfVisibilityChanged(); |
3432 } | 3433 } |
3433 } | 3434 } |
3434 | 3435 |
3435 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { | 3436 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { |
3436 return GetJavaScriptDialogCreatorInstance(); | 3437 return GetJavaScriptDialogCreatorInstance(); |
3437 } | 3438 } |
3438 | 3439 |
3440 void Browser::RenderViewCreated(TabContents* source, RenderViewHost* host) { | |
3441 // TODO(sky): move this to a TabContentsObserver hung off TabContentsWrapper, | |
jam
2011/06/08 17:09:30
you can send this now in ExtensionTabHelper which
sky
2011/06/08 17:19:43
That will work now because the window id is in the
| |
3442 // then nuke this method. | |
3443 host->Send(new ExtensionMsg_UpdateBrowserWindowId( | |
3444 host->routing_id(), | |
3445 source->controller().window_id().id())); | |
3446 } | |
3447 | |
3439 /////////////////////////////////////////////////////////////////////////////// | 3448 /////////////////////////////////////////////////////////////////////////////// |
3440 // Browser, TabContentsWrapperDelegate implementation: | 3449 // Browser, TabContentsWrapperDelegate implementation: |
3441 | 3450 |
3442 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, | 3451 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, |
3443 int32 page_id) { | 3452 int32 page_id) { |
3444 if (GetSelectedTabContentsWrapper() != source) | 3453 if (GetSelectedTabContentsWrapper() != source) |
3445 return; | 3454 return; |
3446 | 3455 |
3447 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); | 3456 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); |
3448 if (!entry || (entry->page_id() != page_id)) | 3457 if (!entry || (entry->page_id() != page_id)) |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4695 TabContents* current_tab = GetSelectedTabContents(); | 4704 TabContents* current_tab = GetSelectedTabContents(); |
4696 if (current_tab) { | 4705 if (current_tab) { |
4697 content_restrictions = current_tab->content_restrictions(); | 4706 content_restrictions = current_tab->content_restrictions(); |
4698 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4707 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4699 // See comment in UpdateCommandsForTabState about why we call url(). | 4708 // See comment in UpdateCommandsForTabState about why we call url(). |
4700 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4709 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4701 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4710 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4702 } | 4711 } |
4703 return content_restrictions; | 4712 return content_restrictions; |
4704 } | 4713 } |
OLD | NEW |