| 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/ui/panels/panel.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 base::DictionaryValue* | 87 base::DictionaryValue* |
| 88 PanelExtensionWindowController::CreateWindowValueWithTabs( | 88 PanelExtensionWindowController::CreateWindowValueWithTabs( |
| 89 const extensions::Extension* extension) const { | 89 const extensions::Extension* extension) const { |
| 90 base::DictionaryValue* result = CreateWindowValue(); | 90 base::DictionaryValue* result = CreateWindowValue(); |
| 91 | 91 |
| 92 DCHECK(IsVisibleToExtension(extension)); | 92 DCHECK(IsVisibleToExtension(extension)); |
| 93 content::WebContents* web_contents = panel_->GetWebContents(); | 93 content::WebContents* web_contents = panel_->GetWebContents(); |
| 94 if (web_contents) { | 94 if (web_contents) { |
| 95 DictionaryValue* tab_value = new DictionaryValue(); | 95 DictionaryValue* tab_value = new DictionaryValue(); |
| 96 // TabId must be >= 0. Use panel session id to avoid conflict with | |
| 97 // browser tab ids (which are also session ids). | |
| 98 tab_value->SetInteger(extensions::tabs_constants::kIdKey, | 96 tab_value->SetInteger(extensions::tabs_constants::kIdKey, |
| 99 panel_->session_id().id()); | 97 SessionID::IdForTab(web_contents)); |
| 100 tab_value->SetInteger(extensions::tabs_constants::kIndexKey, 0); | 98 tab_value->SetInteger(extensions::tabs_constants::kIndexKey, 0); |
| 101 tab_value->SetInteger( | 99 tab_value->SetInteger(extensions::tabs_constants::kWindowIdKey, |
| 102 extensions::tabs_constants::kWindowIdKey, GetWindowId()); | 100 SessionID::IdForWindowContainingTab(web_contents)); |
| 103 tab_value->SetString( | 101 tab_value->SetString( |
| 104 extensions::tabs_constants::kUrlKey, web_contents->GetURL().spec()); | 102 extensions::tabs_constants::kUrlKey, web_contents->GetURL().spec()); |
| 105 tab_value->SetString(extensions::tabs_constants::kStatusKey, | 103 tab_value->SetString(extensions::tabs_constants::kStatusKey, |
| 106 ExtensionTabUtil::GetTabStatusText(web_contents->IsLoading())); | 104 ExtensionTabUtil::GetTabStatusText(web_contents->IsLoading())); |
| 107 tab_value->SetBoolean( | 105 tab_value->SetBoolean( |
| 108 extensions::tabs_constants::kActiveKey, panel_->IsActive()); | 106 extensions::tabs_constants::kActiveKey, panel_->IsActive()); |
| 109 tab_value->SetBoolean(extensions::tabs_constants::kSelectedKey, true); | 107 tab_value->SetBoolean(extensions::tabs_constants::kSelectedKey, true); |
| 110 tab_value->SetBoolean(extensions::tabs_constants::kHighlightedKey, true); | 108 tab_value->SetBoolean(extensions::tabs_constants::kHighlightedKey, true); |
| 111 tab_value->SetBoolean(extensions::tabs_constants::kPinnedKey, false); | 109 tab_value->SetBoolean(extensions::tabs_constants::kPinnedKey, false); |
| 112 tab_value->SetString( | 110 tab_value->SetString( |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 | 776 |
| 779 void Panel::LoadingStateChanged(bool is_loading) { | 777 void Panel::LoadingStateChanged(bool is_loading) { |
| 780 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); | 778 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); |
| 781 native_panel_->UpdatePanelLoadingAnimations(is_loading); | 779 native_panel_->UpdatePanelLoadingAnimations(is_loading); |
| 782 UpdateTitleBar(); | 780 UpdateTitleBar(); |
| 783 } | 781 } |
| 784 | 782 |
| 785 void Panel::WebContentsFocused(content::WebContents* contents) { | 783 void Panel::WebContentsFocused(content::WebContents* contents) { |
| 786 native_panel_->PanelWebContentsFocused(contents); | 784 native_panel_->PanelWebContentsFocused(contents); |
| 787 } | 785 } |
| OLD | NEW |